Error when comparing field = True

Posted by jsweeny10439 on 26-Aug-2013 16:16

I want to create a standare SQL query that select a field from a database table when one of the other fields is true.  I have tried  the following with and without quotes. It does not recognize true or yes.

Select table.fieldname1 from table where tablefield.name = true

Select table.fieldname1 from table where tablefield.name = yes

Any help is appreciated.

All Replies

Posted by rohit.ramak on 27-Aug-2013 22:36

Where are you executing this statement from?

Did you try using 4GL?

FOR EACH TableName NO-LOCK

   WHERE TableName.FieldName1 = TRUE :


   DISPLAY TableName.FieldName1.


END.

Posted by Thomas Mercer-Hursh on 28-Aug-2013 09:59

What error message are you getting or is it simply that no records are being returned?

Posted by bondjlv007 on 28-Aug-2013 13:56

If you are using SQL, use 0 or 1 instead of true or false.

Posted by jsweeny10439 on 28-Aug-2013 16:10

I figured it out. I needed fieldName1 to be equal to 0.

Thank you.

This thread is closed