I'm transitioning from oracle-based Crystal Reports to SQL Server/Management Studio and I'm having issues recreating the output below within a larger query. I report on patient data so I created a sample table which I hope explains what I need. For the output I need a row for each customer id and 3 frosting columns with the frosting in order of the line number but only those frostings that have a batter_code in (450,360).
Orders:
id line batter_code frosting
234 1 450 chocolate
101 1 111 Strawberry
101 2 450 Orange
101 3 360 Cherry
Customer:
id first_name last_name
234 Jon Smith
101 Jane Smith
Output:
id Last Name First Name Frosting 1 Frosting 2 Frosting 3
101 Smith Jane Orange Cherry
234 Smith Jon Chocolate
I'm sure this situation has been asked and answered but I could not find it. If there is a solution would you care to redirect me? If I need to provide clarification please let me know. Thank you again for your help.