sql 1
select pgdwgms.dwg_no, pgdwgms.dwg_rev, pgdwgms.isse_no
from pgdwgms, pgappref
where pgdwgms.acur_fg = '1'
and pgdwgms.status > '7'
and (PGAPPREF.upd_who = '0032' and PGAPPREF.table_no = '2' and
PGAPPREF.record_type = '1' and pgappref.seq_no = pgdwgms.seq_no )
order by pgdwgms.dwg_no, pgdwgms.dwg_rev
sql2
select pgdwgms.dwg_no, pgdwgms.dwg_rev, pgdwgms.isse_no
from pgdwgms, pgappref, pgissetr
where pgdwgms.acur_fg = '1'
and pgdwgms.status > '7'
and ((instr(PGAPPREF.upd_who, '0') = 1 and table_no = '1' and
record_type = '4')
and pgappref.seq_no = pgissetr.seq_no
and pgissetr.isse_no = pgdwgms.isse_no)
order by pgdwgms.dwg_no, pgdwgms.dwg_rev
如何找两句共同值,不要用inner join语句,TKS
------最佳解决方案--------------------
intersect
------其他解决方案--------------------
union all
------其他解决方案--------------------
交集 就是 intersect
sql1
intersect
seql2
intersect
sql3
intersect
sql4
.....
------其他解决方案--------------------
不明白楼主的意思。。。。两条语句intersect一下会很臃肿?
------其他解决方案--------------------
union all
------其他解决方案--------------------
呵呵,最简单的方法,是用minus
------其他解决方案--------------------
这种方法不适合我的程序,我程序中是判断多条件,根据条件拼接sql
------其他解决方案--------------------
例如满足条件一时sql是sql1(后面的order by 去掉),在sql1基础去写条件2,如果用sql1 minus sql2,出现条件三就不好处理了
------其他解决方案--------------------
select pgdwgms.dwg_no, pgdwgms.dwg_rev, pgdwgms.isse_no
from pgdwgms, pgappref
where pgdwgms.acur_fg = '1'
and pgdwgms.status > '7'
and ((条件一 and (PGAPPREF.upd_who = '0032' and PGAPPREF.table_no = '2' and
PGAPPREF.record_type = '1' and pgappref.seq_no = pgdwgms.seq_no )