Using AND and OR

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Using AND and OR

Post by DavJans » Fri Feb 14, 2014 8:00 pm

I think I know you are doing to tell me to do this the long way but I thought Id ask anyway

here is my code and it doesn't do what I want
put revQueryDatabase( theConnectionID, "SELECT * FROM tracker WHERE trackerjob='" & tJob & "' and trackerfinalqcdate IS NULL or trackercoating IS NULL") into theCursor
what it is doing is this (job and finalqcdate) or coating
what I want is (job and finalqcdate) or (job and coating)
so I"m guessing I'm going to have to rewrite like this
put revQueryDatabase( theConnectionID, "SELECT * FROM tracker WHERE trackerjob='" & tJob & "' and trackerfinalqcdate IS NULL or trackerjob='" & tJob & "' and trackercoating IS NULL") into theCursor

I'm OK with this if its the best way to do it, however thought Id ask just in case because I have 19 columns to check for empty cells and would be a long script.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

DavJans
Posts: 275
Joined: Thu Dec 12, 2013 4:21 pm

Re: Using AND and OR

Post by DavJans » Fri Feb 14, 2014 10:11 pm

After extensive googeling I've come to the conclusion that the only way if to wright it like i rewrote it basically case1 and case2 or case1 and case3 or case1 and case4 and so on, And it works fine but I found a bug with livecode/windows 8.1 x64 The horizontal slider isn't working or I don't have it turned on maybe? maybe bump this post to the proper place for your programming department.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Using AND and OR

Post by MaxV » Mon Feb 17, 2014 1:01 pm

Use always brackets with more then one AND/OR:

Code: Select all

put "SELECT * FROM tracker WHERE (trackerjob='" & tJob & "' AND trackerfinalqcdate IS NULL) OR (trackerjob='" & tJob & "' AND  trackercoating IS NULL)"
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply