Suppose i have a table like this..
ColA ColB ColC
A 100 1
A 200 2
A 300 3
B 100 1
B 200 2
C 300 1
I have to select COLA where 100=1 and 200=2 and 300=3
pls help
Suppose i have a table like this..
ColA ColB ColC
A 100 1
A 200 2
A 300 3
B 100 1
B 200 2
C 300 1
I have to select COLA where 100=1 and 200=2 and 300=3
pls help
There are a few ways to handle that, but this is probably the simplest, and will perform quite decently given your alternatives:
SELECT ColA
FROM MyTable
WHERE (ColB = 100 AND ColC = 1)
OR (ColB = 200 AND ColC = 2)
OR (ColB = 300 AND ColC = 3)
GROUP BY ColA
HAVING COUNT(*) = 3
From what I could understand from your question, you need somthing simple like:
select COLA where ( (COLB=100 and COLC=1) or (COLB=200 and COLC=2) or (COLB=300 and COLC=3) )
or go for the more general:
select COLA where COLB = COLC*100