select * from a,b where hh.a=hh.b;这个有错吗?

lipeng_cq 2005-09-20 04:36:29
a和b表都有关健字hh(户号)
但系统却报错?
...全文
314 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
chichunhua 2005-09-21
  • 打赏
  • 举报
回复
不说了..............
zzxiaoma 2005-09-21
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
luckydog_l 2005-09-21
  • 打赏
  • 举报
回复
应该是a.hh,b.hh
云中客 2005-09-21
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
这个语句的问题在于你关联了两个表,而显示时用*来代替,系统并不知道要代替哪一个表,所以要写清楚
可以这样写:
select a.* ,b.* from a,b where a.hh=b.hh
singlepine 2005-09-21
  • 打赏
  • 举报
回复
select * from a,b where hh.a=hh.b;
--------------------
应该是
select * from a,b where a.hh=b.hh;
也就说是
select * from 表a,表b where 表a的字段hh=表b的字段hh;--表名在前面,字段跟在表名加.的后面
MorningTea 2005-09-21
  • 打赏
  • 举报
回复
楼主lipeng_cq发贴后没有再跟贴:-)
lisiyong 2005-09-21
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
or
select * from a,b where b.hh=a.hh
or
select * from a inner join b on a.hh=b.hh

是正解啊

怎么楼主不说话..........

8254034 2005-09-20
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
zhangyang555 2005-09-20
  • 打赏
  • 举报
回复
up to jackluo1981(无知者无畏)
jackluo1981 2005-09-20
  • 打赏
  • 举报
回复
I guess the sponsor must be fool us!
$扫地僧$ 2005-09-20
  • 打赏
  • 举报
回复
嗨。。。。。。。。。
iwl 2005-09-20
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
常遇道 2005-09-20
  • 打赏
  • 举报
回复
select * from table1 a,tabl2 b where a.hh=b.hh
real_name 2005-09-20
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
or
select * from a,b where b.hh=a.hh
or
select * from a inner join b on a.hh=b.hh
e1000Gb 2005-09-20
  • 打赏
  • 举报
回复
hh.a=hh.b----》a.hh=b.hh
rokky 2005-09-20
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
or
select * from a,b where b.hh=a.hh
or
select * from a inner join b on a.hh=b.hh

都是正解。
feitianbianfu16 2005-09-20
  • 打赏
  • 举报
回复
你的hh.a=hh.b表示是hh表中的a字段和b字段,而a.hh=b.hh表示是a表中的hh字段和b表中的hh字段!
Frewin 2005-09-20
  • 打赏
  • 举报
回复
select * from a inner join b on a.hh=b.hh
churchatp1 2005-09-20
  • 打赏
  • 举报
回复
select * from a,b where a.hh=b.hh
or
select * from a,b where b.hh=a.hh
MorningTea 2005-09-20
  • 打赏
  • 举报
回复
select a.* ,b.* from a,b where a.hh=b.hh;
或者表别名

select Table1.* ,Table2.* from a Table1,b Table2 where Table1.hh=Table2.hh;

如果字段名不同,那么就不用加上表名标示,你要用就更好
例如:
select a.* ,b.* from a,b where h1=h2;
select a.* ,b.* from a,b where a.h1=b.h2;


加载更多回复(3)

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧