-
MS SQL Query Problem
HI
I have to fetch record from the table in the folowing manner
CaseID Rating Description
100 Rating Desc1
101 Rating Desc2
100 Rating Desc3
Result set should contain the value like this
CaseID Rating Description
100 Rating Desc1,Rating Desc3
101 Rating Desc2
How to write query for this type of fetching the values from DB ?
Can any one please help me....its urgent
-
MS Query Problem
Originally Posted by skrish_tnsk
HI
I have to fetch record from the table in the folowing manner
CaseID Rating Description
100 Rating Desc1
101 Rating Desc2
100 Rating Desc3
Result set should contain the value like this
CaseID Rating Description
100 Rating Desc1,Rating Desc3
101 Rating Desc2
How to write query for this type of fetching the values from DB ?
Can any one please help me....its urgent
Is my query is not clear or it is not possible in query ?
Last edited by skrish_tnsk; 03-04-2008 at 07:17 AM.
Reason: No reply
-
This is going to require that you build a crosstab report, something which is not inherently available in MS-SQL. There are two broad avenues you can follow:
1) Create a temp table to sort your results into the appropraite column, then use another query to collapse these results. This is an appropriate strategy when the output values from the base table are known (i. e. creating a report from a vertical table that has values in a column for each month).
2) Use dynamic SQL to perform the same basic function as option 1. This is useful when the values that are to be converted to columns are NOT known, but it requires some pretty intricate programming.
Hope this helps!
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
|
|