SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How do I combine multiple rows into one (each column has different value) ?


How do I combine multiple rows into one (each column has different value) ?

Author
Message
Tamrak
Tamrak
SSC-Addicted
SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)

Group: General Forum Members
Points: 405 Visits: 154


I need help on getting another query to wrap the results from this query. The actual data has more columns (fields) than I have shown here.

How can I come up with one ticket number per row and each column could fill the value of 'Yes' or 'N/A' in the appropriate columns?

The end result should be one ticket # per row.
DesNorton
DesNorton
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18133 Visits: 7632
Tamrak - Thursday, March 1, 2018 10:04 AM


I need help on getting another query to wrap the results from this query. The actual data has more columns (fields) than I have shown here.

How can I come up with one ticket number per row and each column could fill the value of 'Yes' or 'N/A' in the appropriate columns?

The end result should be one ticket # per row.


SELECT number
, Mandatory = MAX(Mandatory)
, Valid = MAX(Valid)
, ....
FROM ...
GROUP BY number



How to post data/code on a forum to get the best help.
Make sure that you include code in the appropriate IFCode tags.
Tamrak
Tamrak
SSC-Addicted
SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)

Group: General Forum Members
Points: 405 Visits: 154
Thank you very much. That's work great.
Tamrak
Tamrak
SSC-Addicted
SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)SSC-Addicted (405 reputation)

Group: General Forum Members
Points: 405 Visits: 154
DesNorton - Thursday, March 1, 2018 10:15 AM
Tamrak - Thursday, March 1, 2018 10:04 AM


I need help on getting another query to wrap the results from this query. The actual data has more columns (fields) than I have shown here.

How can I come up with one ticket number per row and each column could fill the value of 'Yes' or 'N/A' in the appropriate columns?

The end result should be one ticket # per row.


SELECT number
, Mandatory = MAX(Mandatory)
, Valid = MAX(Valid)
, ....
FROM ...
GROUP BY number

Thanks for quick response.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search