Skip to content
Advertisement

how to get data grouped by ids

I have grouped data in a temporary table according to id_card. There are multiple activities for each card. I want to send 1 email for all activities happened on that particular card. But, I don’t know how to get data according to ids. should i use cursor for fetching the ids ? Example in the table, want 2 rows for id_card =1 and then 2 rows for id_card = 3 and so on

Can you please help. Thanks very much

Advertisement

Answer

You may use a while loop, something like this

db<>fiddle demo

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement