这个查询怎么做? --userid1对应的usernameSELECT usernameFROM table1,table2WHERE table1.userid=table1.userid1--userid2对应的类似 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.* from table2 a,table1 b where a.userid=b.userid and b.username=条件 select t1a.username, t1b.username from table2 t2 inner join table1 t1a on t2.userid1 = t1a.userid inner join table1 t1b on t2.userid2 = t1b.userid to xelite(潜龙):这样分别查我会。我想问得是一次可否查询得到?怎样做这个视图? create view v_table2 as select a.* from table2 a,table1 b where a.userid=b.userid and b.username=条件Go select a.username,b.usernameFrom table2 c join table1 a on c.userid1 = a.userid join table1 b on c.userid2 = b.userid SELECT usernameFROM table1,table2WHERE table1.userid=table2.userid1 or table1.userid=table2.userid2 select a1.username,a2.usernamefrom table2 b left join table1 a1 on b.userid1=a1.useridleft join table1 a2 on b.userid2=a2.userid sql2000如何重新生成日志 如何导出数据为“.doc”的格式 求一SQL语句 求GUID函数 使用ADO控件+VB编程时怎么样操作数据库才是高效率?? 高手请进,sql 2005 弹出自定义对话框问题? ROW_NUMBER用法 Access中查询中的字段求和问题。 请教一个关于文件上传问题 查询出现?号了为啥 如何取出最新的记录! 求一本书,或者一个开发文档,谢谢。
from table2 t2 inner join table1 t1a on t2.userid1 = t1a.userid
inner join table1 t1b on t2.userid2 = t1b.userid
这样分别查我会。我想问得是一次可否查询得到?怎样做这个视图?
as
select a.* from table2 a,table1 b where a.userid=b.userid and b.username=条件
Go
From table2 c
join table1 a on c.userid1 = a.userid
join table1 b on c.userid2 = b.userid
FROM table1,table2
WHERE table1.userid=table2.userid1 or table1.userid=table2.userid2
from table2 b left join table1 a1 on b.userid1=a1.userid
left join table1 a2 on b.userid2=a2.userid