Subject | Re: [firebird-support] outer joins |
---|---|
Author | Helen Borrie |
Post date | 2004-08-04T01:01:29Z |
At 07:20 PM 3/08/2004 +0000, you wrote:
for a re-entrant join on ClientInfo.
Try:
select count(*)
from ClientInfo CI
right outer join ActionLog AL on CI.Client_ID = AL.Client_ID
right join CompanyInfo CO
on CI Company_ID = CO.Company_ID
That said, because of the outer joins, this particular query doesn't
actually tell you anything about the count of rows in any particular table.
It will always return True if there is at least one row in any table.
In any case, unless you really-really-really want to count rows, don't use
this kind of query. For an existence test, use
...
where EXISTS (
select 1 from ClientInfo CI
right outer join ActionLog AL on CI.Client_ID = AL.Client_ID
right join CompanyInfo CO
on CI Company_ID = CO.Company_ID )
Still, maybe you really are trying to count rows for some useful purpose....
/heLen
>I have 3 tablesAs it is, it's not legal join syntax. Also, there's no apparent reason here
>
>ActionLog
> ClientInfo (Client_ID)
> CompanyInfo (Company_ID)
>
>
>where ClientInfo is an outer join on ActionLog (got that working
>fine) but CompanyInfo needs to have an outer join on ClientInfo--
>which I can't get the to work. (I understand why it doesn't work,
>just not what to do to get it to work).
>
>My SQL is:
>
>select count(*)
>from ClientInfo CI right outer join ActionLog AL on CI.Client_ID =
>AL.Client_ID, CompanyInfo CO right outer join Clientinfo CI2 on
>CO.Company_ID = CI2.Company_ID
>
>How should I change it?
for a re-entrant join on ClientInfo.
Try:
select count(*)
from ClientInfo CI
right outer join ActionLog AL on CI.Client_ID = AL.Client_ID
right join CompanyInfo CO
on CI Company_ID = CO.Company_ID
That said, because of the outer joins, this particular query doesn't
actually tell you anything about the count of rows in any particular table.
It will always return True if there is at least one row in any table.
In any case, unless you really-really-really want to count rows, don't use
this kind of query. For an existence test, use
...
where EXISTS (
select 1 from ClientInfo CI
right outer join ActionLog AL on CI.Client_ID = AL.Client_ID
right join CompanyInfo CO
on CI Company_ID = CO.Company_ID )
Still, maybe you really are trying to count rows for some useful purpose....
/heLen