我正在尝试将此查询从MSSQL转换为MYSQL
有人可以发现第2行的第一个where子句有什么问题吗?当该行存在时,我会收到此错误,但是如果没有它,查询运行会很好:
错误代码:1064。检查与您的MySQL服务器版本相对应的手册,以获取正确的语法,以在第2行“哪里(从行列中选择idCartRow,其中despatchMethod ='Special Delivery'')中使用
SELECT 'Special Delivery' as despatchmethod
where (select idCartRow from cartrows where despatchMethod = 'Special Delivery' and idBatch = 853850) > 0
union all select distinct (select IFNULL(Options.DeliveryCompany,IFNULL(cr.ActualDespatchMethod,cr.despatchMethod))) as despatchmethod
from cartrows cr left outer join Options on Options.idOption = cr.admid
where idBatch = 853850