就是由用户根据几个关键字段增加了许多组合条件至表中,然后我现在有一条数据想判断是否符合条件表里的所有查询条件。
比如:
年龄(age) 身高(height)
18 170
17 150
-- 110 而我现在表tableA中有一个年龄16岁,身高110是否在以上所有的条件内?最直观的办法就是用如下查询语句:
select count(*) from tableA where age=18 and height=170 or age=17 and height=150 or height=110
但该办法太复杂,请教各位高手有其它解新决办法吗?多谢了!
比如:
年龄(age) 身高(height)
18 170
17 150
-- 110 而我现在表tableA中有一个年龄16岁,身高110是否在以上所有的条件内?最直观的办法就是用如下查询语句:
select count(*) from tableA where age=18 and height=170 or age=17 and height=150 or height=110
但该办法太复杂,请教各位高手有其它解新决办法吗?多谢了!
select count(*) from tableA where height=110 and age=16;--如>=1,则说明此表中有,否则,表中没有年龄16岁且身高为110cm的人员。