求助 sql查询语句 select username,alljf,QQID,addtime from [user] where [id] in (select tjrid from [tjrinfo] where tid = @tid)
现在要加个查询字段是 表[tjrinfo]里面的 state字段
需要怎么写 求助
------解决方案--------------------
SQL code
DECLARE @TID INT
SELECT USERNAME ,
ALLJF ,
QQID ,
ADDTIME ,
( SELECT STATE
FROM [TJRINFO]
WHERE TJRID = T.ID
)
FROM [USER] T
WHERE [ID] IN ( SELECT TJRID
FROM [TJRINFO]
WHERE TID = @TID )