SQL Server 2000 中的这个操作数(*= 星号等于)是什么?
我有一个从 ms sql 2000 中提取并插入到 MySql 查询中的查询。它不起作用,MySql 会因 *= 运算符而卡住。在此示例中,我有两个名为 person_name 的 varchar 列。
SELECT * FROM tbl1 a, tbl2 b
WHERE a.id = b.id
AND a.person_name *= b.person_name
我知道在其他语言中 myInt *= myTotal 也可以读作 myInt * myInt = myTotal。但是,我正在使用包含所有字符但不包含整数的 varchar。我这样写:
AND a.person_name * a.person_name = b.person_name
瞧!看来这已经奏效了。有人可以解释发生了什么事吗? *= 运算符是将字符转换为其整数等效项还是?为什么我在网络上找不到这个运营商?
I have a query that I pulled from ms sql 2000 and plugged into a MySql query. It did not work, MySql would choke on the *= operator. In this example I have two varchar columns called person_name.
SELECT * FROM tbl1 a, tbl2 b
WHERE a.id = b.id
AND a.person_name *= b.person_name
I know in other languages myInt *= myTotal could also be read as myInt * myInt = myTotal. However, I'm working with varchars that contain all chars, no integers. I wrote it out like:
AND a.person_name * a.person_name = b.person_name
Voila! It appears to have worked. Can somebody explain what is happening? Is the *= operator converting the chars to their integer equivalents or? And why couldn't I find this operator anywhere on the web?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 SQL 2000 中,这被用作 LEFT OUTER JOIN
=* 是 RIGHT OUTER JOIN
您的查询可以是:
如所述 此处:
In SQL 2000 this was used as a LEFT OUTER JOIN
=* is a RIGHT OUTER JOIN
Your query could be:
As stated here:
在 MSSQL 中,WHERE 子句中的 *= 约定表示连接。因此,您真正看到的是 person_name 上 tbl1 和 tbl2 之间的 LEFT OUTER JOIN,其中将返回 tbl1 中的所有值和 tbl2 上的匹配值。
In MSSQL, the *= convention in the WHERE clause indicates a join. So what you are really seeing is a LEFT OUTER JOIN between tbl1 and tbl2 on person_name where all the values from tbl1 and the matching values on tbl2 will be returned.