我尝试在SQL Server 2016上运行需要从Mysql链接数据库获取数据的查询。
SELECT o.*, name
FROM [DBS].[dbo].[Users] AS o WITH (NOLOCK)
CROSS APPLY (SELECT b.code FROM users.members b WHERE name = 'name') ou name
WHERE b.date > '2016-01-01'
如何使用CROSS APPLY执行此类查询?
答案 0 :(得分:1)
MySQL中没有CROSS APPLY
运算符。在这种情况下,您只需使用CROSS JOIN
:
SELECT o.*, ou.code AS name
FROM [Users] AS o
CROSS JOIN (
SELECT b.code
FROM users.members b
WHERE name = 'name') AS ou
WHERE b.date > '2016-01-01'
请注意,由于没有相关性,因此无需在SQL Server中执行CROSS APPLY
。