Format table with SQL to put multiple entry on one row
Posted On
Posted By admin
I’m currently working on an Access database, and I would like to make a query that can fuse multiple rows into one, but keeping all the entries separated in differents columns.
The table i’m making my query on is called “Monthly”, is used for monthly reports of activity and is made this way:
project | date | turnover | margin |
---|---|---|---|
0001 | 01/01/ | 10000 | 20% |
0001 | 01/02/ | 10500 | 15% |
0002 | 01/01/ | 8500 | 25% |
I would like to know if there is a way to transform it into this:
project | date | turnover | margin | date | turnover | margin |
---|---|---|---|---|---|---|
0001 | 01/01/ | 10000 | 20% | 01/02/ | 10500 | 15% |
0002 | 01/01/ | 8500 | 25% | 01/02/ |
I first thought of using GROUP BY
, but it’s clearly not adapted.
The objective would be to format it on a SQL request, not to modify the structure/ how the data is stored.
Thanks in advance for anyone who answers.