我正在尝试通过使用包含如下列的 mySQL 查询来构建 tableadaptor:
if((`c`.`timed` > 0), 'Y', 'N') AS `Timed`,
这在我在 MySQL 工作台中运行时有效,但在 VS2012 中导致错误,无法生成 select 语句。
我也尝试过使用
case `c`.`timed` when 0 then 'Y' when 1 then 'N' end AS `Timed`,
没有成功。
有人能告诉我这个查询应该怎么写吗?
谢谢
完整查询:
select
`c`.`callid` AS `callid`,
concat(`cs`.`firstname`, ' ', `cs`.`lastname`) AS `Customer`,
`c`.`postcode` AS `postcode`,
`c`.`type` AS `type`,
if((`c`.`timed` > 0), 'Y', 'N') AS `Timed`, `c`.`calldate` AS `calldate`,
`c`.`notes` AS `notes`,
`c`.`driver` AS `Driver`
from
(((`quick-quote-2`.`call` `c`
left join `quick-quote-2`.`driver` `d` ON ((`c`.`driver` = `d`.`driverid`)))
left join `quick-quote-2`.`booking` `b` ON ((`c`.`booking` = `b`.`bookingid`)))
left join `quick-quote-2`.`customer` `cs` ON ((`b`.`customer` = `cs`.`customerid`)))
where
(`c`.`canx` = 0)
错误:
Error in list of function arguments: '>' not recognised
unable to parse query text