Subject | SELECT FIRST in subselects |
---|---|
Author | Bjoern Reimer |
Post date | 2005-06-22T15:55:43Z |
The following query gives me too much records.
I'd expect four records.
SELECT * FROM DBINFO I
WHERE
I."Id" in (SELECT FIRST 2 I1."Id" FROM DBINFO I1 WHERE I1."Label" = 'AENDERUNG' ORDER BY I1."CreatedAt" DESC)
OR
I."Id" in (SELECT FIRST 2 I2."Id" FROM DBINFO I2 WHERE I2."Label" = 'DATUM' ORDER BY I2."CreatedAt" DESC)
What I get is
SELECT * FROM DBINFO I
WHERE I."Label" = 'AENDERUNG' OR I."Label" = 'DATUM'
Where is my mistake?
Bjoern
--
SOFTbaer --- reimer@... --- www.softbaer.de
I'd expect four records.
SELECT * FROM DBINFO I
WHERE
I."Id" in (SELECT FIRST 2 I1."Id" FROM DBINFO I1 WHERE I1."Label" = 'AENDERUNG' ORDER BY I1."CreatedAt" DESC)
OR
I."Id" in (SELECT FIRST 2 I2."Id" FROM DBINFO I2 WHERE I2."Label" = 'DATUM' ORDER BY I2."CreatedAt" DESC)
What I get is
SELECT * FROM DBINFO I
WHERE I."Label" = 'AENDERUNG' OR I."Label" = 'DATUM'
Where is my mistake?
Bjoern
--
SOFTbaer --- reimer@... --- www.softbaer.de