mardi 19 mai 2020

SQL. Get samples of data in group query

I have a simple table with only 2 columns:

| name | domain |

I need a SQL query to get this data:

| domain | names count | sample name 1 | ...2 | ...3 | ...4 | ...5 |

So, the first part is simple, just grouping by domain and getting names count. But the second part, where I need to take 5 samples (they can be random) of names in the group - I have no idea how to resolve it.




Aucun commentaire:

Enregistrer un commentaire