我想将数据从SQL过滤到我的数据网格。
我有:
1表(tableX)
3列
Col1 Col2 Col3
1/x/10 BJB 1/20/20
1/y/10 BJB 1/20/30
1/x/10 BJB 1/20/30
1/y/10 BJB 1/20/20
2 datagrid(dg1,dg2)
我想要插入:
dg1 with col1" 1 / x / 10"和col3" 10/20/20"
dg2,col1" 1 / y / 10和col3" 10/20/20
我只能过滤一个Col3
"SELECT Col1, Col2, Col3 FROM Tablex WHERE Col3='10/20/20'"
如何过滤col1女巫包含" x"或" y"和col3?
=============================================== ===========================
O YEAH ..感谢您的回答。
这对于dg1
("SELECT Col1, Col2, Col3 FROM TableX WHERE Col1 like ('%/X/%') AND Col3='10/20/20'")
这对于dg2,不同的只是X和Y..lol
("SELECT Col1, Col2, Col3 FROM TableX WHERE Col1 like ('%/Y/%') AND Col3='10/20/20'")
答案 0 :(得分:1)
SELECT Col1, Col2, Col3
FROM Tablex
WHERE Col3='10/20/20'
AND (COL1 like '%/x/%' or COL1 like '%/y/%')
答案 1 :(得分:0)
SELECT Col1, Col2, Col3
FROM Tablex
WHERE COL1 IN ('1/x/10', '1/y/10')
AND Col3 = '10/20/20
或者您可以使COL1
过滤器更加模糊。
SELECT Col1, Col2, Col3
FROM Tablex
WHERE COL1 IN ('%/x/%', '%/y/%')
AND Col3 = '10/20/20