Im busy with a script to display transactions.
I want to write an SQL query which sets everything on one line.
Here is the SQL :
SELECT transactienummer, code
FROM gb_kaarten
ORDER BY transactienummer DESC
LIMIT 4
this is the output :
transactienummer code
43141 1600
43141 4410
43141 1513
43141 1514
I just want to have a line that looks like this :
transactienummer code
43141 1600 4410 1513 1514
I have tried some joins, but i dont seem to get it.
Thanks in forehand for the help
I assume that you are using mysql, you should do something like this:
SELECT transactienummer, GROUP_CONCAT(string SEPARATOR ' ')
FROM gb_kaarten
GROUP BY code;
Pay attention that you will have all the result in one field separated by ''
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With