Reputation: 43
This is my table
I want to create a function that get the total amoun of duration for a car/(regNr)
It should take the argument regNr and calculate the amount of duration
So for example ABC123 should get the total duration - 180.
Thanks.
Upvotes: 0
Views: 33
Reputation: 54212
You can try this:
SELECT regNr, CONCAT('total duration - ', SUM(duration)) AS output FROM table_name
GROUP BY regNr
which will output:
regNr output
======================================
ABC123 total duration - 180
DEF456 total duration - 130
Upvotes: 1