[RESOLVED] SQL select with multiple values
Hi All,
My table having the fields as below.
347 111 2 15 187 6/8/2010 1:19:44 PM
348 111 2 21 187 6/8/2010 1:19:44 PM
349 111 2 42 187 6/8/2010 1:19:44 PM
350 111 3 42 187 6/8/2010 1:19:44 PM
351 111 4 42 187 6/8/2010 1:19:44 PM
How to select the row that must contains both 2,3,4
Thanks a lot.
Re: SQL select with multiple values
Contains 2,3,4 in what field?
Re: SQL select with multiple values
Thanks dee-U
I have found the solution with the code as below
SELECT ID
FROM TableName
WHERE ThirdField IN (2,3,4)
GROUP BY ID
HAVING COUNT(DISTINCT ThirdField) = 3
Re: [RESOLVED] SQL select with multiple values
My guess is the third column :-)
Select ThirdColumn from MyTable where ThirdColumn in (2,3,4)
Or
Select ThirdColumn from MyTable where ThirdColumn = 2 or ThirdColumn = 3 or ThitdColumn = 4