Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-02-14 : 09:31:08
|
| Ron writes "I have a table ORDER which contains an ItemID field. Now i have two other tables viz. STANDARD and CUSTOM. I want to retrieve a dataset which will have the item name from either STANDARD or CUSTOM, depending on the field ItemID. If the ItemID value is in the range 100 to 200 then it should get the ITEMName from STANDARD table. Else if it is from 300 to 400, then it should be from CUSTOM table. Can please, please, please anyone help me with this query.Thanks a lot in advance." |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-14 : 09:41:00
|
| Select S.columns from Order O inner join STANDARD S on O.ItemID =S.ItemID where O.ItemID between 100 to 200Union allSelect C.columns from Order O inner join CUSTOM C on O.ItemID =C.ItemID where O.ItemID between 300 to 400MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|