日期:2014-05-16 浏览次数:20873 次
select id,(select xingming from [user] where userid=a.daibanzhang) as daibanzhang,
(select xingming from [user] where userid=a.zhibanyuan) as zhibanyuan,
(select xingming from [user] where userid=a.jishuyuan) as jishuyuan,
(select xingming from [user] where userid=a.fayi) as fayi,
riqi
from zhiban a
SELECT
T1.ID
,T2.XINGMING AS DAIBANZHANG
,T3.XINGMING AS ZHIBANYUAN
,T4.XINGMING AS JISHUYUAN
,T1.RIQI
FROM ZHIBAN T1 INNER JOIN USER T2 ON T1.DAIBANZHANG = T2.USERID
INNER JOIN USER T3 ON T1.ZHIBANYUAN = T3.USERID
INNER JOIN USER T4 ON T1.JISHUYUAN = T4.USERID
WHERE T1.ID = 1
sql="select A.id xid,B.xingming daibanzhang,C.xingming zhibanyuan,D.xingming jishuyuan,E.xingming fayi,A.riqi riqi"
sql=sql&" from zhiban A,user B,user C,user D,user E"
sql=sql&" where B.id=A.daibanzhang and C.id=A.zhibanyuan and D.id=A.jishuyuan and E.id=fayi"
sql=sql&" order by A.id"
<td>rs("xid")</td>
<td>rs("daibanzhang")</td>
<td>rs("zhibanyuan")</td>
<td>rs("jishuyuan")</td>
<td>rs("fayi")</td>
<td>rs("riqi")</td>