I want to build a list of Lastnames to filter out from the results of the second select statement something like this (which doesn't do it)
DECLARE @ExcludedList VARCHAR(MAX)
SET @ExcludedList = (SELECT TOP 20 Lastname
FROM dbo.Subscribers
where [Firstname] = 'Dave')
SELECT [Firstname], Count([Firstname]) as [Count] from Subscribers
WHERE [Lastname] not in (@ExcludedList)
Aucun commentaire:
Enregistrer un commentaire