I currently have a table in the following format and with the following example data:
transaction name receipt
1 jim aisjdy
2 john uuyjskl
2 john ioxiqo
3 will eurique
1 jim xoqiel
3 will sijcjg
Each transaction is associated with the customer’s name and they receive two separate receipts.
How would one go about creating a query that would display ‘transaction’, ‘name’ and the two different receipts in one row?
Example:
transaction name receipt receipt
1 jim aisjdy xoqiel
I know this is bad practice and, in an idea world, I’d have created two columns containing the two different receipts and/or normalized the table into two tables containing transaction and name in one, and receipt 1 and 2 in another. Unfortunately, I did not produce this table and I do not have the time to restructure everything.
I would kindly appreciate any help – thanks in advance!
Since there are only two values, you can use group by: