andrew gatt <[EMAIL PROTECTED]> wrote:
select 1 from table where id == 1 OR id == 2;
which will return:
1
1
if they both exist, but if one doesn't exist i can't tell which one
it is. Is there some way to get the statement to return a row with a
0 if the id doe not exist?
1
0
Or do i have to do the check for each one?
If you can create a temp table, say IdList, with your list of IDs, then
you can have
select id, id in (select id from table)
from IdList
If your list of IDs is reasonably small, you can generate a query
looking like this:
select id, id in (select id from table)
from (
select 1 id
union all
select 2 id
union all
select 3 id
);
Igor Tandetnik