February 12, 2004 at 2:12 am
How do I convert the following T-SQL query to a SQL 92 statement
select *
from authors a, titles t, titleauthor ta
where a.au_id *= ta.au_id
and t.title_id *= ta.title_id
February 12, 2004 at 4:51 am
The equivalent SQL 92 statement would be
select * from (select * from authors a,titles ta) z left outer join titleauthor ta on ta.title_id=z.title_id and ta.au_id=z.au_id
If the statement changed slightly to
select * from authors a, titles t, titleauthor tawhere a.au_id =* ta.au_idand t.title_id =* ta.title_id
The equivalent SQL 92 statement would be
select a.*,t.*,ta.* from titleauthor ta left outer join authors a on a.au_id = ta.au_idleft outer join titles t on t.title_id = ta.title_id
That's it!
Thanx
February 13, 2004 at 10:16 am
inugroho is right on. Your original query does not look useful, you probably wanted to put the * on other side of the equals sign? Then inugroho's second ansi-92 query is very clean, and useful.
February 18, 2004 at 7:40 am
yeah thanx for the help
i know the query won't be very helpful. it was just a prototype of some bigger queries.
any wy i'll ty this out.
thanx a lot
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply