17,377
社区成员
发帖
与我相关
我的任务
分享
select a.STOREID,a.fj,a.cbdw,a.xbrq,a.dbsx,a.dbbh,a.dbrq,a.dblb,a.lwdw,b.blqkwj,b.blrq,b.blqk,c.bljgwj
from tab801 a,tab805 b,tab808 c
where a.cbbljg_doc = concat('808.',c.storeid) and a.cbblqk_doc = concat('805.',b.storeid)
order by a.storeid
where EXISTS(SELECT 1 FROM tab801_$$$_TEMP t WHERE tab801.STOREID=t.ID AND t.FLAG=1)
select mytable.*
(select a.STOREID,a.fj,a.cbdw,a.xbrq,a.dbsx,a.dbbh,a.dbrq,a.dblb,a.lwdw,b.blqkwj,b.blrq,b.blqk,c.bljgwj
from tab801 a,tab805 b,tab808 c
where a.cbbljg_doc = concat('808.',c.storeid) and a.cbblqk_doc = concat('805.',b.storeid)
order by a.storeid) mytable
where EXISTS
(SELECT 1 FROM tab801_$$$_TEMP t, tab801, mytable
WHERE tab801.storeid = t.ID and t.flag = 1 and tab801.storeid = mytable.storeid
)
select a.STOREID,a.fj,a.cbdw,a.xbrq,a.dbsx,a.dbbh,a.dbrq,a.dblb,a.lwdw,b.blqkwj,b.blrq,b.blqk,c.bljgwj
from tab801 a,tab805 b,tab808 c
where a.cbbljg_doc = concat('808.',c.storeid) and a.cbblqk_doc = concat('805.',b.storeid)
and EXISTS(SELECT 1 FROM tab801_$$$_TEMP t WHERE a.STOREID=t.ID AND t.FLAG=1)
order by a.storeid
--直接放在一起不是也可以吗?
select a.STOREID,
a.fj,
a.cbdw,
a.xbrq,
a.dbsx,
a.dbbh,
a.dbrq,
a.dblb,
a.lwdw,
b.blqkwj,
b.blrq,
b.blqk,
c.bljgwj
from tab801 a,
tab805 b,
tab808 c,
tab801_$$$_TEMP t
where a.cbbljg_doc = concat('808.',c.storeid) and
a.cbblqk_doc = concat('805.',b.storeid) and
a.STOREID=t.ID
AND t.FLAG=1
order by a.storeid;