|
-
May 27th, 2009, 09:30 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] subquery problem thanks for help
Hi all,
I have 3 tables.
I want select data from 1 of the table but and using subquery to select another 2 value from another 2 tables.
actually i want to do a comparison if table A Type = 'E' then select from Table B if Type ='S' select from Table C.
How do I accomplish this ?
Thanks a million!
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
-
May 27th, 2009, 09:46 AM
#2
Re: subquery problem thanks for help
Which database? What are the table structures? Can they be linked?
If TableA can be linked to Tables B and C, then simple Left Joins would work.
In SQL Server you could also use something like
Select Case Type
When 'E' Then (Select....)
When 'S' Then (Select...)
Else Null End As ColumnName,
Other Columns...
From TableA
-
May 28th, 2009, 07:33 PM
#3
Thread Starter
Hyperactive Member
Re: subquery problem thanks for help
Thanks bruve you solved my problem but I need to put a "(" before select and ")" after End.
really appreciate....
(Select Case Type
When 'E' Then (Select....)
When 'S' Then (Select...)
Else Null End) As ColumnName,
Other Columns...
From TableA
Where there is no hope, there can be no endeavor.
There are two ways of rising in the world, either by your own industry or by the folly of others.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|