sqlfiddle - 如何在 sql.js 中编写 datediff() - “sql.js 应该具有相同的输出”?
问题描述
我有一个使用 sql.js 的在线代码评估表我有这个在 sqlfiddle com 中运行良好的 mysql 代码:
select
buy.buy_id,
datediff(date_step_end ,date_step_beg) as Количество_дней,
if(days_delivery < datediff(date_step_end ,date_step_beg),
datediff(date_step_end ,date_step_beg)-days_delivery,0) as Опоздание
from city inner join client on city.city_id = client.city_id
inner join buy on buy.client_id = client.client_id
inner join buy_step on buy_step.buy_id = buy.buy_id
inner join step on step.step_id = buy_step.step_id
where buy_step.step_id = 3 and date_step_end is not null
它无法正确评估上面的代码:
sql.js should have the same output
SyntaxError: Parse error on line 5:
...p_end ,date_step_beg)
from
-----------------------^
Expecting 'COMMA', 'IN', 'LIKE', 'ARROW', 'DOT',
'CARET', 'EQ', 'SLASH', 'TILDA', 'GLOB', 'NOT_LIKE',
'BARBAR', 'MINUS', 'DOUBLECOLON', got 'RPAR'
got 'RPAR' 表示右括号。我认为这是无法识别的 datediff() 函数。
如何使它在 sql.js 中工作?
解决方案
推荐阅读
- asp.net-mvc-4 - 部分视图在 POSTBACK 上返回 NULL
- azure - 将客户端应用程序限制为仅访问特定的 Web api
- java - 使用策略或附加类?
- wordpress - 在 Slider Revolution、Wordpress 中获取产品标签
- url-rewriting - 如何在 Xquery 的自定义重写器代码中包含 Marklogic rest-api?
- function - Go 函数中的函数参数
- javascript - 无法使用私有 IP 从 Cloud Functions 连接到 Cloud SQL SQL Server
- android - Espresso 测试随机失败,可能是时间问题
- angular - 在 Storybook (Angular) 上捕获 control.setValue 动作
- python - 在 ipywidgets 上更改 jupyter 中的指针光标