One more query problem
-
Suppose i have a table like this..
COL1 COL2 COL3
X 100 1
X 200 2
X 300 3
Y 100 1
Y 200 2
Z 300 1i want to select col1 where 100=1 and 200=2 and 300=3
My small attempt...
-
Suppose i have a table like this..
COL1 COL2 COL3
X 100 1
X 200 2
X 300 3
Y 100 1
Y 200 2
Z 300 1i want to select col1 where 100=1 and 200=2 and 300=3
My small attempt...
In the where clause convert both col2 & 3 to strings and compare the first character of each.
Never underestimate the power of human stupidity RAH
-
Suppose i have a table like this..
COL1 COL2 COL3
X 100 1
X 200 2
X 300 3
Y 100 1
Y 200 2
Z 300 1i want to select col1 where 100=1 and 200=2 and 300=3
My small attempt...
Solution 1:
SELECT COL1
FROM tbl_Test
WHERE COL2 = (COL3 * 100);Solution 2:
SELECT COL1
FROM tbl_Test
WHERE (COL2 = 100 AND COL3 = 1)
OR (COL2 = 200 AND COL3 = 2)
OR (COL2 = 300 AND COL3 = 3)Solution 3:
select COL1
from tbl_Test
where ( (COL2=100 and COL3=1) or (COL2=200 and COL3=2) or (COL2=300 and COL3=3) )Please vote :)
Niladri Biswas