I am creating a report for a customer. In it I need to combine information from 4 tables. It's all fine until the last table, where I use just one column. This column contains phones and emails (all in one). I need to display email address and phone number in separate column, but they come from the same column.
I can display both but they show in separate rows. I can also duplicate the column and then sort it out in excel but customer needs to be able to do it themselves without editing it after.
SELECT CustomerProcessO.GID, CustomerProcessO.FOIF, Customers.FirstName, Customers.LastName, SalesPersons.FirstName, SalesPersons.LastName, DynamicListData.DataContent AS Email, DynamicListData.DataContent AS Phone FROM CustomerProcessO LEFT OUTER JOIN Customers ON CustomerProcessO.id = Customers.id LEFT OUTER JOIN SalesPersons ON CustomerProcessO.GIDSalesPerson = SalesPersons.GID LEFT OUTER JOIN DynamicListData ON ParentId = Customers.id WHERE DynamicListData.KeyField = 'EMAILS' OR DynamicListData.KeyField = 'PHONES'
The results I'm getting are correct but I get phone numbers and emails in two separate rows. I need to have one column with email and one column with phone number