Create a self join select statement

I have a select statement with the following fields (FFDCUSN, FFDCSCD, FFDCGRP, FFDCTPE) see image but altered to provide repeated CUSN for each of the other fields.

alt text

I need a query that will return the FFDCUSN with a column containing the values for each of the additional column that contains a form of customer grouping. See prefered output image below: I figure this needs to be a self join but can't quite wrap my brain around the formating

Preferred Output:

alt text

capture.jpg (141.0 kB)
capture2.jpg (25.5 kB)
more ▼

asked Feb 26, 2015 at 07:09 PM in Default

avatar image

0 2

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
more ▼

answered Feb 26, 2015 at 07:16 PM

avatar image

3.5k 3 6

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Feb 26, 2015 at 07:09 PM

Seen: 49 times

Last Updated: Mar 06, 2015 at 11:44 AM

Copyright 2018 Redgate Software. Privacy Policy