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 |
mahdi87_gh
Yak Posting Veteran
72 Posts |
Posted - 2012-03-04 : 07:33:38
|
HiI have these tablesRawNews(NewsID,Title,Text)NewsGroup(GroupID,Title,Description)UsedNewsID(UsedID,NewsID,GroupID)the scenario is first users add RawNewses and then they wanna add these newses to NewsGroups. (UsedNews table)now i want to get a status of RawNewses to see which Groups are using a RawNews. if my data was like belowRawNews1 --- raw1 --- text12 --- raw2 --- text2NewsGroups1 --- Sport --- sport News2 --- Political --- Political News3 --- Economic ---- Economic NewsUsedNews1 --- 1 --- 12 --- 1 --- 23 --- 2 --- 14 --- 2 --- 25 --- 2 --- 3i want the query result like below:NewsID - Title - Text - Status1 --- raw1 --- text1 --- sport News Political News2 --- raw2 --- text2 --- sport News Political News Economic Newsthanks |
|
mahdi87_gh
Yak Posting Veteran
72 Posts |
Posted - 2012-03-04 : 10:12:31
|
HiI found the solution Myselfi created a Function and used it in select query |
 |
|
namman
Constraint Violating Yak Guru
285 Posts |
Posted - 2012-03-04 : 13:13:55
|
Using for xml path('') in the select is another solution that may be better performance. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|