在链接 Mysql 服务器中查询

Query in Linked Mysql server

您好,我已将我的 MYSQL 服务器 (172.xx.xx.xx) 链接到我的 sql 服务器。但是在使用查询时它提供了错误。

select * from OPENQUERY ([MYSQL],'select * from example.address_table limit 10')

此查询工作正常,但在执行以下查询时出现错误:-

select * from OPENQUERY ([MYSQL],'select * from example.address_table
where (create_date between '2015-01-01 00:00:00' and '2015-01-31 23:59:59') or 
(modified_date between '2015-01-01 00:00:00' and '2015-01-31 23:59:59');

如何解决链接服务器中的查询。

这是错误

Unclosed quotation mark after the character string ')

鉴于您的错误,这应该是解决方法

select * from OPENQUERY ([MYSQL],'select * from example.address_table 
where (create_date between ''2015-01-01 00:00:00'' and ''2015-01-31 23:59:59'') or 
(modified_date between ''2015-01-01 00:00:00'' and ''2015-01-31 23:59:59'')');