Subject RE: [ib-support] Re: joins in sql
Author Wilson, Fred
You wrote:
"(just tried to save some connection
time)."

You certainly don't need to close, and then re-open the connection between
queries...

Best regards,
Fred Wilson
SE, Bell & Howell
fred.wilson@...



-----Original Message-----
From: harri007et <harri@...> [mailto:harri@...]
Sent: Tuesday, January 07, 2003 11:54 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] Re: joins in sql


Hi Luc!

>> SELECT COUNT(A.STATUS), SUM(A.STATUS)
>> FROM TABLE1 A
>> JOIN TABLE2 B ON B.L_ID = A.O_ID
>> LEFT OUTER JOIN TABLE3 C ON C.O_ID = B.L_ID
>> LEFT OUTER JOIN TABLE1 D ON D.O_ID = B.L_ID
>> LEFT OUTER JOIN TABLE3 E ON E.ID = A.OS_ID
>> LEFT OUTER JOIN TABLE1 F ON F.OS_ID = E.ID

> 1. Each record from table A that has more than one
> corresponding entry in any of the joined tables will
> be counted several times, too.
>(What are the joins for anyway???)
I removed all other "select" parts - count(distinct(E.ID),
count(distinct F.ID) etc. for simlicity as they were correct.
Also removed "where" part.

Table2->Table3->Table1 are related like master-detail-subdetail,
also Table2(master) has direct link to Table1(subdetail).
Each table has it's own filter.

I realized now, that what I was trying to do is very simple, but
impossible inside ONE query (just tried to save some connection
time).

Thanks,
Harri




To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



[Non-text portions of this message have been removed]