Gunakan:
WITH sample AS (
SELECT t.*,
ROW_NUMBER() OVER (PARTITION BY t.state
ORDER BY NEWID()) AS rank
FROM ZIPCODES t)
SELECT s.*
FROM sample s
WHERE s.rank <= 5
Gunakan:
WITH sample AS (
SELECT t.*,
ROW_NUMBER() OVER (PARTITION BY t.state
ORDER BY NEWID()) AS rank
FROM ZIPCODES t)
SELECT s.*
FROM sample s
WHERE s.rank <= 5
Cara memfilter Baris dengan Nilai Null di Select Statement di SQL Server - Tutorial SQL Server / TSQL Bagian 110
kueri sql untuk perbedaan antara baris saat ini dan baris sebelumnya berdasarkan datetime
Encoding SQL_Latin1_General_CP1_CI_AS ke dalam UTF-8
Cara menentukan apakah instance SQL Server peka huruf besar-kecil atau tidak
Mengapa SQL Server menambahkan integer 4 byte ke indeks berkerumun non-unik