我有一个学校表,一个已知变量range,当range=-1时候,就取表中所有的值,当range=3,4等数字的时候,就取range范围的值.select语句应该如何写 select * from colleges where case when range=-1 then ....else then... 拜托了,分可以再加的.
发表于:2007-07-02 13:01:201楼 得分:0
在sql语句外面判断不是更好?
发表于:2007-07-02 13:16:382楼 得分:0
这种情况用union是不是简单些? select * from colleges where range=-1 union all select * from colleges where range in (3,4) and range....