私はこの結果セットを持っています:
select a.id, a.categoria from Articolo a
where novita = 1
order by a.categoria, newid()
id categoria
----------- -----------
3 4
11 4
1 4
12 5
13 5
4 6
そして、各カテゴリから最初の製品を (ランダムな順序で) 取得します。
id categoria
----------- -----------
3 4
12 5
4 6
理想的には次のようなもの
select FIRST(a.id), a.categoria from Articolo a
where novita = 1
order by a.categoria, newid()
何か案は?