Select distinct a.id, a.lb,a.subject,a.nowuser, \ decode(b.done, 'ready', decode(b.xh, '1', '1')) nosign , a.wcrq\ from model_list a, model_ b \ where a.author = '%s' And a.id = b.mid and a.lb in (3,4,6) \ and a.wcrq > add_months(sysdate,-1) \ order by a.wcrq desc
SELECT DISTINCT a.id, a.lb, a.subject, a.nowuser, decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0') nosign, a.wcrq FROM model_list a, model_ b WHERE a.author = '%s' AND a.id = b.mid AND a.lb IN (3, 4, 6) AND a.wcrq > add_months(SYSDATE, -1) AND decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0') <> '0' ORDER BY a.wcrq DESC 不能直接上传图片,只能链接
Select a.id, a.lb, a.subject, a.nowuser, a.wcrq,sum(decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0')) nosign from model_list a, model_ b where a.author = '%s' And b.mid=a.id and a.lb in (3,4,6) and a.wcrq > add_months(sysdate,-2) Group By a.Id, a.lb,a.subject,a.nowuser,a.wcrq order by a.wcrq Desc我自己想出来了,不过这个在sqlPlus里面执行正确,在vc中CRecordSet一Open就变异常了,是不是语句太长了
Select a.id, a.lb, a.subject, a.nowuser, a.wcrq, sum(decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0'))nosign from model_list a, model_ b where a.author = '%s' And b.mid=a.id and a.lb in (3,4,6) and a.wcrq > add_months(sysdate,-2) Group By a.Id, a.lb,a.subject,a.nowuser,a.wcrq order by a.wcrq Desc自己想出来了,执行也没有问题呵呵!
decode(b.done, 'ready', decode(b.xh, '1', '1')) nosign , a.wcrq\
from model_list a, model_ b \
where a.author = '%s' And a.id = b.mid and a.lb in (3,4,6) \
and a.wcrq > add_months(sysdate,-1) \
order by a.wcrq desc
a.lb,
a.subject,
a.nowuser,
decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0') nosign,
a.wcrq
FROM model_list a, model_ b
WHERE a.author = '%s' AND
a.id = b.mid AND
a.lb IN (3, 4, 6) AND
a.wcrq > add_months(SYSDATE, -1) AND
decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0') <> '0'
ORDER BY a.wcrq DESC
不能直接上传图片,只能链接
想要只有nosign为1的,就不显示为0的那条数据
没理解是什么意思
这样不行,如果有一条记录只有nosign=0,没有nosign=1的情况,查询的结果就不全了
a.lb,
a.subject,
a.nowuser,
a.wcrq,
sum(decode(b.done, 'ready', decode(b.xh, '1', '1', '0'), '0'))nosign
from model_list a, model_ b
where a.author = '%s' And b.mid=a.id and a.lb in (3,4,6)
and a.wcrq > add_months(sysdate,-2)
Group By a.Id, a.lb,a.subject,a.nowuser,a.wcrq
order by a.wcrq Desc自己想出来了,执行也没有问题呵呵!