SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Adding data into a VIEW with CASE and PIVOT
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ChelleMcG
Starting Member

United Kingdom
1 Posts

Posted - 02/22/2013 :  09:30:22  Show Profile  Reply with Quote
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)

USA
7020 Posts

Posted - 02/22/2013 :  12:11:27  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 02/23/2013 :  02:32:45  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000