Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Derived table in the Select statement

Status
Not open for further replies.

jliang

MIS
Apr 26, 2004
30
US
Hi,

I need write a sql like:

select case when a.col1 in (select col1 from table2)
then 'ok' else 'fail' end
from table2 b

Can I pass a derived table in this statement?

Many thanks in advance

Jing
 
try this


select case when a.col1 = b.col1
then 'ok' else 'fail'
end
from ( table1 a left outer join table2 b on
a.col1 = b.col1 )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top