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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Adding data into a VIEW with CASE and PIVOT

Author  Topic 

ChelleMcG
Starting Member

1 Post

Posted - 2013-02-22 : 09:30:22
I've inherited a very complicated-looking view which uses CTE, CASE and PIVOT and I need to include some additional data. Multiple rows with data in one column, VisitType, is being split by way of a case statement and then pivoted across 8 columns with each containing the date of the visit.

In another related table I have a column ImageType and each row can contain either 1, 2 or 3 to record which images were taken at each visit. Is it possible to concatenate this image data with those dates, so that column 'Visit 1' would contain '2013-02-22 1,2,3' to show that on this date 3 images were taken?

Only been working with SQL Server for a week so any help would be greatly appreciated.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2013-02-22 : 12:11:27
You want us to help with code that you did not post?



CODO ERGO SUM
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-23 : 02:32:45
sounds like this is what you're after

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -