Rich,

Thanks. Simply writing the initial e-mail helped clarify things for me. 

We?re trying to work out the logic of setting holiday_mode to an explicit 0 
rather than an assumed 0. Its not quite as simple as setting it in a table as 
its linked back to a mobile app and the synchronisation logic is a little 
convoluted. 

If we can force holiday_mode to be set to either 0 or 1 then the problem goes 
away, which comes down to getting the design right. I think that this ?issue? 
we have is indicative of a poor DB design and wrong assumptions (bad pun) and 
we should fix that.

Rob.

> On 23 May 2015, at 17:06, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> 
> On Sat, 23 May 2015, Rob Willett wrote:
> 
>> What I want to do is join the table Users and Perimeter Notifications
>> together but only if the value of Devices.Holiday_Mode is either non
>> existent or if Devices.Holiday_Mode does exist and its 0. If
>> Devices.Holiday_Mode is 1 it means the user is on holiday and don?t send
>> them anything.
> 
> Rob,
> 
>  First, you can set holiday_mode to 0 by default rather than leaving it
> NULL (unknown). As you wrote, unless the user explicitly sets the mode to 1
> the assumption is that its value is 0. After all, it's gotta' be one or the
> other, right?
> 
>  Second, select * from Devices where holiday_mode == 0. Use that as a
> sub-query and join users to the results. Now you have a list of user email
> addresses for only those with holiday_mode of zero.
> 
> HTH,
> 
> Rich
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to