Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Crosstab Query Issue

Author  Topic 

tinamiller1
Yak Posting Veteran

78 Posts

Posted - 2015-03-30 : 17:04:32
I have a table and trying to do a complex crosstab or union and the outcome is not working the way I need it to. I had to assign a value to the text field because the crosstab does not like nonvalues from what I see but the value is actually a text field. Here is an example of the data in the database on the server and the output I need.


DATA HAVE
LastName FirstName Date Info
DOE SARAH 10/15/2014 NA
DOE SARAH 10/16/2014 ALMOST
DOE SARAH 10/17/2014 ALWAYS
DOE SARAH 10/18/2014 COMPLETE
DOE SARAH 10/19/2014 NO
LANCE BRANDY 10/15/2014 NA
LANCE BRANDY 10/16/2014 ALMOST
LANCE BRANDY 10/17/2014 ALWAYS
LANCE BRANDY 10/18/2014 COMPLETE
LANCE BRANDY 10/19/2014 NO
MIRIAM SUE 10/15/2014 NA
MIRIAM SUE 10/16/2014 ALMOST
MIRIAM SUE 10/17/2014 ALWAYS
MIRIAM SUE 10/18/2014 COMPLETE
MIRIAM SUE 10/19/2014 NO


DATA NEED
1 row for each total 3 rows and it should be laid out
last/first/date1/info1/date2/info2/date3/info3/date4/info4/date5/info5

I would paste a copy of the data have but it does not paste correctly and I see no way to attach anything on the forum




tina m miller
   

- Advertisement -