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 |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-22 : 01:12:55
|
| Dear experts,please let me know where is the mistake in my queryselect distinct (select COLUMN003 from TABLE021 where COLUMN001 = t.COLUMN001)+ '(' +(select COLUMN002 from TABLE021 where COLUMN001 = t.COLUMN001)+ ')' as tablename (select COLUMN003 from CATABLE009 where COLUMN001 = t.COLUMN003) modulename from TABLE022 t order by tablenameVinodEven you learn 1%, Learn it with 100% confidence. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-22 : 01:22:15
|
1. subquery may return more than 1 rowwhy are you not using JOIN to do it ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-06-22 : 01:46:50
|
| can you please tell me how can i use join hereVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-22 : 01:52:04
|
[code]SELECT DISTINCT a.COLUMN003 + '(' + a.COLUMN002 + ')' AS tablename, b.COLUMN003 AS modulenameFROM TABLE022 t INNER JOIN TABLE021 a ON t.COLUMN001 = a.COLUMN001INNER JOIN CATABLE009 b ON t.COLUMN003 = b.COLUMN001ORDER BY tablename[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-22 : 01:52:07
|
| Can you explain what you are trying to do?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|