Mengikuti (sama persis) kueri seperti milik Anda memberikan hasil yang Anda tentukan.
;WITH q AS (
SELECT ID = 1, Fname = 'John', Lname = 'Doe'
UNION ALL SELECT 2, 'Barry', 'Singer'
UNION ALL SELECT 3, 'John', 'Doe'
UNION ALL SELECT 4, 'James', 'Brown'
)
SELECT *
FROM q
WHERE Fname = 'John' AND Lname = 'Doe'
Hasil
ID Fname Lname
----------- ----- ------
1 John Doe
3 John Doe
(2 rows affected)