This topic is locked
[SOLVED]

 Query Designer

3/9/2011 3:16:17 PM
PHPRunner General questions
bbarker author

In query designer, I'm trying to list a report but only when values EXIST in a particluar field.
If I use "exists" or " <>'' ", it doesn't work.
What should I enter in the FILTER field so that it will ignore records where that field is empty?
Example - Don't want to list record where CLUB is blank:
SELECT

tblstalls.VendorID,

tblvendors.Last Name,

tblvendors.First Name,

tblvendors.Club,

FROM tblstalls

INNER JOIN tblvendors ON tblstalls.VendorID = tblvendors.VendorID

WHERE (tblvendors.Club <>' ') <<------HERE

P
procheck 3/9/2011

Try adding a semi-colon at the end.

bbarker author 3/9/2011



Try adding a semi-colon at the end.


That didn't work... it responds with a query error message now.
----SOLUTION
I found that this works:

> ''
(using single quotes)

Sergey Kornilov admin 3/9/2011

You need to compare it with empty string while now you comparing it with the space character.
Try this:

WHERE tblvendors.Club <>''


Additional bit of info. If this field contains NULL values you can use the following:
WHERE tblvendors.Club NOT IS NULL
More info:

http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html

bbarker author 3/10/2011



You need to compare it with empty string while now you comparing it with the space character.
Try this:

WHERE tblvendors.Club <>''



Thanks... I tried that previously... but now I think that I had a space between the apostrophes.
<>'' is not equal to <>' '
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=56983&image=1&table=forumreplies' class='bbc_emoticon' alt='B)' /> :-)