I'm looking for a functionality where i can export data from a database into excel where each select distinct result should be written into a separate tab.

I have 74 distinct numbers from :

select distinct(nr) from table;


The records for nr 1 should be written to sheet 1
The records for nr 2 should be written to sheet 2

and so on.

How would that be done?

Best regards,