In Jet, I want to test if certain conditions return any results.
I want a query which returns exactly one record: "true" if there are any results, "false" otherwise.
This works in MS SQL:
SELECT
CASE
WHEN EXISTS(SELECT * FROM foo WHERE <some condition>)
THEN 1
ELSE 0
END;
This is what I have tried in Jet:
SELECT IIF(EXISTS(SELECT * FROM foo WHERE <some condition>), 0, 1);
which gives me the error:
Reserved error (-3025); there is no message for this error.
Any ideas?
NOTE I don't want to select "true" multiple times by tacking on a FROM clause at the end, because it could be slow (if the FROM table had many records) or undefined (if the table had 0 records).