I have the following result from my SQL query:
EventID P_Num PN_NameCount1 PN_Name
ABC-I-10942683 1089213 1 Company 1
ABC-I-10942683 1326624 8 Company 2
I am still learning this capability in SQL and need some assistance, Pivot's are NOT working in this scenario.
I have tried several different ways in attempting to do this, but was not able to create the desired results:
EventID P_Num1 PNC1 PN_Name PNC_Num2 PNC2 PN_Name
ABC-I-10942683 1089213 1 Company 11326624 8 Company 2
The EventID
will change based on the different events from the companies, as the EventID
is based on a particular date the event occurred with the company.
This is just a sample of the 500K+ rows of data I am working with. This will go into a temp table to be joined with the other various pieces of data needed.
I have tried this without success:
SELECT Key,
MAX(Col1) AS Col1,
MAX(Col2) AS Col2,
MAX(Col3) AS Col3
FROM table
GROUP BY Key