一百分相送,sql语法,决不食言
我有个页面需要一下处理:
xzbmxx_info 部门表
info_policebase 人员信息表
原来方案:
<%
set ks_rst = server.CreateObject("adodb.recordset")
ks_sql = "select info_name,info_bh from xzbmxx_info order info_bh"
ks_rst.open ks_sql,conn,3,3
while not ks_rst.eof
'列出该部门人员列表
ry_sql = "select name,jobcode from info_policebase where unitid='"&ks_rst("info_bh")&"' order by jobcode"
set ry_rst=conn.execute(ry_sql)
while not ry_rst.eof
'输出部门名称
response.Write(ks_rst("info_name"))
'输出人员姓名
response.Write(ry_rst("name"))
'输出职务名称
set zw_rst = conn.execute("select mean from code_job where code='"&ry_rst("jobcode")&"'")
response.Write(" ("&zw_rst("mean")&") ")
ry_rst.movenext
wend
ks_rst.movenext
wend
现在我想把两条sql合并成一条
select zhao.xzbmxx_info.info_name,zhao.info_policebase.name,zhao.info_policebase.jobcode
from zhao.info_policebase,zhao.xzbmxx_info
where zhao.info_policebase.unitid
in (select zhao.xzbmxx_info.info_bh from zhao.xzbmxx_info )
order by zhao.info_policebase.jobcode
出现死循环症状,请麻烦找出原因
asp+oracle环境