Sunday, 15 March 2015

Determine existence of results in jet SQL? -


In jets, I want to test that some conditions be returned to any result.

I want a query that gives a record exactly: "correct" if there are any results, then "wrong" otherwise.

This works in MS SQL:

  Select when in the current state (SELECT * FROM) Foo WHERE & lt; Some status & gt;) THEN 1 ELSE 0 END;  

This is what I tried to do in Jet:

  SELECT IIF (EXISTS (SELECT * FROM Foo WHERE & lt; some condition & gt; ), 0, 1);  

Gives me an error:

  Reserved Error (-3025); There is no message for this error  

Any ideas?

Note I do not want to select "true" several times by attacking an FROM block at the end, because it can be slow (if there were many records in the FM table) Or undefined (if the table had 0 records).

No comments:

Post a Comment