abgsc
asked on
Merge two rows in SQL
Hi,
we have created a view that shows info from many different tables joined together. the output look like this
SELECT * from view_Analysts
AS-IS result:
id date analyst type
1 10/10/2009 Smith Lunch
1 10/10/2009 Hall Lunch
2 12/11/2009 Smith Lunch
3 13/11/2009 Jackson Group
3 13/11/2009 Harris Group
TO-BE result
id date analyst type
1 10/10/2009 Smith+Hall Lunch
2 12/11/2009 Smith Lunch
3 13/11/2009 Jackson+Harris Group
When all columns, except analyst, is the same, then mergethe two rows into one row with a '+' sign in analyst column
How can I write my sql to get TO-BE output?
we have created a view that shows info from many different tables joined together. the output look like this
SELECT * from view_Analysts
AS-IS result:
id date analyst type
1 10/10/2009 Smith Lunch
1 10/10/2009 Hall Lunch
2 12/11/2009 Smith Lunch
3 13/11/2009 Jackson Group
3 13/11/2009 Harris Group
TO-BE result
id date analyst type
1 10/10/2009 Smith+Hall Lunch
2 12/11/2009 Smith Lunch
3 13/11/2009 Jackson+Harris Group
When all columns, except analyst, is the same, then mergethe two rows into one row with a '+' sign in analyst column
How can I write my sql to get TO-BE output?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.