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