select sysdate
from dual
where (select case
when (zys - bjs = zys) then
'1=1 and xb=''1'''
when (abs(zys - bjs) = bjs) then
'2=2 and xb=''1'''
else
'3=3 and xb=''1'''
end
from (select (select count(*)
from jx0503tzd
where jx0404id = xk.jx0504id) zys,
(select count(*)
from jx0503tzdbj
where jx0404id = xk.jx0504id) bjs
from jx0504 xk
where xk.jx0504id = '201120122000571'))
类似这样的,当然这样是不行的
1、首先我们先看一下我们的这个表信息。
2、接着我们使用创建查询的方法,来测试sql。
3、select的where的条件查询格式:select 【所选字段列表】 from 【数据表名】 where 条件表达式。
4、上面那个是查询表中年龄大于10的数据。
5、当然如果你有多个条件也可以写,多个条件表达式。要是用and进行连接。and就是并且的意思。