一个简单的问题问一下

csdn小虫 2007-08-29 05:52:28
sql2000中
select * from tb_student a,tb_score b
where (a.student_no*= b.student_no)

where语句中a.student_no*= b.student_no
其中*号什么作用????????
...全文
213 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Lyw110 2007-08-29
  • 打赏
  • 举报
回复
*= 简单说就是左连接
=* 就是右连接
dobear_0922 2007-08-29
  • 打赏
  • 举报
回复
改下:
select * from tb_student a,tb_score b
where (a.student_no*= b.student_no)
等价于:
select * from tb_student a,tb_score b
where (b.student_no is null) or (a.student_no= b.student_no)
dobear_0922 2007-08-29
  • 打赏
  • 举报
回复
谢谢小楼,我记错了,汗,对不起楼主~~~~
Limpire 2007-08-29
  • 打赏
  • 举报
回复
-- 改为:
select * from test1 a left join test2 b on a.id = b.id

-- 一样的意思
xiachangyu 2007-08-29
  • 打赏
  • 举报
回复
刚才用这东东出现错误
select * from test1 a ,test2 b where (a.id*=b.id)

服务器: 消息 4147,级别 15,状态 1,行 1
此查询使用的不是 ANSI 外部联接运算符("*=" 或 "=*")。若要不进行修改即运行此查询,请使用存储过程 sp_dbcmptlevel 将当前数据库的兼容级别设置为 80 或更低。极力建议使用 ANSI 外部联接运算符(LEFT OUTER JOIN、RIGHT OUTER JOIN)重写此查询。在将来的 SQL Server 版本中,即使在向后兼容模式下,也不支持非 ANSI 联接运算符。
Limpire 2007-08-29
  • 打赏
  • 举报
回复
简单点:
*=左联接
=*右联接
Limpire 2007-08-29
  • 打赏
  • 举报
回复
*=运算符

在早期的 Microsoft® SQL Server™ 2000 版本中,使用 *= 和 =* 在 WHERE 子句中指定左、右外部联接条件。有时,该语法会导致有多种解释的不明确查询。FROM 子句中指定遵从 SQL-92 的外部联接,不会导致上述不确定性。因为 SQL-92 语法更为精确,所以,本版中未包括有关在 WHERE 子句中使用旧的 Transact-SQL 外部联接语法的详细信息。以后的 SQL Server 版本可能不再支持该语法。任何使用 Transact-SQL 外部联接的语句都应改为使用 SQL-92 语法。

SQL-92 标准支持 FROM 或 WHERE 子句中的内部联接规范。WHERE 子句中指定的内部联接不会出现与 Transact-SQL 外部联接语法相同的不确定性问题。
Limpire 2007-08-29
  • 打赏
  • 举报
回复
楼上错

a.student_no*=b.student_no:返回a中所有的student_no,b中不在a的不返回。
b.student_no*=a.student_no:返回b中所有的student_no,a中不在b的不返回。
dobear_0922 2007-08-29
  • 打赏
  • 举报
回复
select * from tb_student a,tb_score b
where (a.student_no*= b.student_no)
等价于:
select * from tb_student a,tb_score b
where (a.student_no is null) or (a.student_no= b.student_no)

34,576

社区成员

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

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