By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Records: 5 Duplicates: 0 Warnings: 0
Records: 4 Duplicates: 0 Warnings: 0
customerid2 | name | productname | total | total_sum |
---|---|---|---|---|
1 | jon | car | 10 | 15 |
2 | steve | car | 5 | 15 |
4 | ned | boat | 2 | 3 |
3 | ted | boat | 1 | 3 |
json_result |
---|
{"product": "15 car", "customer": {"name": "jon", "total": 10, "customerid": 1}} |
{"product": "15 car", "customer": {"name": "steve", "total": 5, "customerid": 2}} |
{"product": "3 boat", "customer": {"name": "ned", "total": 2, "customerid": 4}} |
{"product": "3 boat", "customer": {"name": "ted", "total": 1, "customerid": 3}} |
json_result |
---|
{"product": "3 boat", "customer": [{"name": "ned", "total": 2, "customerid": 4}, {"name": "ted", "total": 1, "customerid": 3}]} |
{"product": "15 car", "customer": [{"name": "jon", "total": 10, "customerid": 1}, {"name": "steve", "total": 5, "customerid": 2}]} |