I'm working on a script that should pull a set of primary keys when there is a match for 3 pieces of information. Here is he basic query:
SELECT a."ID"
FROM "Message" a
WHERE a."ID_Staff" = ? AND a."Mailbox_ID" = ? AND a."viewed" = ?
ID_Staff and Mailbox_ID are text fields and viewed is a number field.
When the values are:
ID_Staff = 10,
Mailbox_ID = 633 and
viewed = 1
it pulls the correct data set. When viewed has a value of 0 no records are returned. Going to the base table and doing a find with the same values finds the correct record set. So the SQL should work.
Is there something that should be different for number fields with a value of 0? Any suggestions on this would be greatly appreciated.
Are you sure the value is 0 and not empty NULL? If empty, you’d have to query for: and a.”viewed” IS NULL