Hi Guys,I am trying to display some information using the case statement. I want to display the dates that the contact information was edited in a database.When I use the case statement each item goes into a new column on a different line and the customers entry for HomePhone, CellPhone and workPhone is repeated 3 timese.g cardno WorkNoEntrydate CellNoEntrydate HomeNoEntrydate HP WP CPcust1 20070101 null null 12 11 NULcust1 null 20060101 null 12 11 NULcust1 null null 20050101 12 11 NULI actually want the above information to look like thiscardnumber homephone cellphone workphonecust1 20050101 20060101 20070101
How can I accomplish this? I have attached the codeselect distinct c.cardnumber ,FirstName ,InitialsName ,LastName ,AddressLine1 ,AddressLine2 ,AddressLine3 ,HomePhone ,CellPhone ,WorkPhone ,c.EntryDate as createdate ,case when fieldname = 'Phone Work' then p.entrydate else 'none' end WorkPhoneEntrydate ,case when fieldname = 'Phone Cell' then p.entrydate else 'none' end CellPhoneEntrydate ,case when fieldname = 'Phone Home' then p.entrydate else 'none' end HomePhoneEntrydate from Customer c left outer join phonedates p on c.cardnumber=p.cardnowhere c.cardnumber in (select cardnumber from AlternateAccessKeys where IsCreditCardKey='yes')order by c.cardnumber
Thanks in advance