改成这样呢: select a.userName,a.userPw,a.userId,a.SendNums,b.Id,b.QuserId,b.QTitle,b.QContent from userInfo a inner JOIN Qnews b on QuserId='1' WHERE a.SendNums=(select min(SendNums) from userInfo)
结果都一样啊。显示了多条记录是不是得加一个关联条件呢: select a.userName,a.userPw,a.userId,a.SendNums,b.Id,b.QuserId,b.QTitle,b.QContent from userInfo a inner JOIN Qnews b on QuserId='1' WHERE a.SendNums=(select min(SendNums) from userInfo) and a.关联字段 = b.关联字段
try this,select a.userName,a.userPw,a.userId,a.SendNums,b.Id,b.QuserId,b.QTitle,b.QContent from Qnews b inner join userInfo a on b.QuserId=a.userId and b.QuserId='1' where a.SendNums=(select min(SendNums) from userInfo)
select a.userName,a.userPw,a.userId,a.SendNums,b.Id,b.QuserId,b.QTitle,b.QContent
from userInfo a inner JOIN Qnews b on QuserId='1' WHERE
a.SendNums=(select min(SendNums) from userInfo)
结果都一样啊。显示了多条记录是不是得加一个关联条件呢:
select a.userName,a.userPw,a.userId,a.SendNums,b.Id,b.QuserId,b.QTitle,b.QContent
from userInfo a inner JOIN Qnews b on QuserId='1' WHERE
a.SendNums=(select min(SendNums) from userInfo)
and a.关联字段 = b.关联字段
from Qnews b
inner join userInfo a on b.QuserId=a.userId and b.QuserId='1'
where a.SendNums=(select min(SendNums) from userInfo)
我尝试了好多办法,好多方法,因为是两张独立的表,我没有办法用哪个字段能把他们关联起来。
如果我把:b.QuserId=a.userId 两个字段关联起来,设置成同一个值,那查询结果,又返回到了原始状态。