sql内连接查询2个表有关联的id的信息
如:表一员工申请表ygsq,字段:id,标题,内容
表二管理人员审核表 ygsq_jl,字段:id,ygsq_id,审核内容
sql语句如下:(重审核表中查询出所有不重复的申请记录)
sql="select distinct ygsq_id from ygsq inner join ygsq_jl on ygsq.id=ygsq_jl.ygsq_id where ygsq_jl.userid='"&session("userName_nbsiounbae498523")&"'"
if request("keyword")<>"" then
sql=sql&" and ygsq.标题 like '%"&request("keyword")&"%'"
end if