I have the following data and would like to find a way using either MS Access SQL or MS SQL Server to create a query to consolidate everything to a single line.
RespondentID Name EID Phone Why How Contact
1809593812 Testing 0
1809593812 Testing 0
1809593812 19091193 0
1809593812 Jennifer 0
1809593812 8885555555 0
I would like it to look like:
RespondentID Name EID Phone Why How Contact
1809593812 Jennifer 19091193 8885555555 Testing Testing 0
Is this possible using either MS Access SQL Query or MS SQL Server Query?
There are many more records like this. I do not have control over its layout as it is a daily export from an external source.
What I have so far in MS Access Query is:
SELECT DISTINCT dbo_ResponsesText.RespondentID,
IIf(dbo_ResponsesText.Key1=4383976121,ResponseText,Null) AS Name,
IIf(dbo_ResponsesText.Key1=4383976120,ResponseText,Null) AS EID,
IIf(dbo_ResponsesText.Key1=4388819402,ResponseText,Null) AS Phone,
IIf(dbo_ResponsesText.QuestionID=340372755,ResponseText,Null) AS Why,
IIf(dbo_ResponsesText.QuestionID=340372805,ResponseText,Null) AS How,
IIf(dbo_Responses.Key1=4305593988,-1,0) AS Contact
FROM dbo_ResponsesText
INNER JOIN dbo_Responses ON dbo_ResponsesText.RespondentID = dbo_Responses.RespondentID
ORDER BY dbo_ResponsesText.RespondentID
Actual Table Structure:
dbo_ResponsesText Table
ID RespondentID CollectorID QuestionID Key1 ResponseText DateAdded
1 1821607396 25982810 340372755 0 Name,EID,etc. 5/1/2012 3:29:00 PM
dbo_Responses Table:
RespondentID CollectorID QuestionID Key1 Key2 Key3
1809593812 25982810 340372567 4308039090 0 0