Subject | Re: [firebird-support] Cannot use distinct together with subselect |
---|---|
Author | Daniel Rail |
Post date | 2003-09-10T16:32:53Z |
Hi,
At September 10, 2003, 12:55, Florian Hector wrote:
[...snip...]
SELECT TABKOMMUNIKATION.KOMMID
, KOMARTID
, (Select KomArtDesc from tabKomart where
tabKommunikation.KomArtID=tabKomArt.KomArtID) AS Art
, KOMMDETAIL
, KOMMREMARK
FROM TABKOMMUNIKATION
JOIN TABUSERXKOMMUNIKATION ON
TABKOMMUNIKATION.KOMMID=TABUSERXKOMMUNIKATION.KOMMID
Where (TABUSERXKOMMUNIKATION.PersID<> :PersID)
Also, EXISTS only returns true if at least one record is returned in
the subselect, and doesn't look at the result set.
--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)
At September 10, 2003, 12:55, Florian Hector wrote:
[...snip...]
> This gives me all entires in a table except the ones which are alreadyFor your query, you don't have to use the EXISTS clause. See below:
> assigned to the currently selected Person.
> It is possible, that entries are assigned to more than one person so I get
> multiple lines of the same entry.
> So I tried to to put a Distinct right after the first Select in order to get
> unique lines, but then I get the following error.
> Invalid token.
> invalid request BLR at offset 185.
> context already in use (BLR error).
> However, it does work with the distinct when the first subselect is removed.
> What can I do to get this working with the subselect?
SELECT TABKOMMUNIKATION.KOMMID
, KOMARTID
, (Select KomArtDesc from tabKomart where
tabKommunikation.KomArtID=tabKomArt.KomArtID) AS Art
, KOMMDETAIL
, KOMMREMARK
FROM TABKOMMUNIKATION
JOIN TABUSERXKOMMUNIKATION ON
TABKOMMUNIKATION.KOMMID=TABUSERXKOMMUNIKATION.KOMMID
Where (TABUSERXKOMMUNIKATION.PersID<> :PersID)
Also, EXISTS only returns true if at least one record is returned in
the subselect, and doesn't look at the result set.
--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)