gpt4 book ai didi

MySQL 查询到 MS SQL

转载 作者:太空宇宙 更新时间:2023-11-03 12:16:57 25 4
gpt4 key购买 nike

我有以下 MySQL 查询:

SELECT date, time, custom_id, Number
FROM traffic t
WHERE CONCAT(date, " ", time) BETWEEN "01/06/2014 00:00" AND "01/10/2014 23:00"
AND Number =
(SELECT MAX(CAST(Number as SIGNED)) FROM traffic WHERE t.date = date and t.custom_id = custom_id)
ORDER BY date, CAST(Number as SIGNED) DESC, custom_id

这是 MySQL 中的 SQLFiddle(工作):http://sqlfiddle.com/#!2/6e1248/3

如何将其转换/翻译为 MS SQL? SQLFiddle(不工作):http://sqlfiddle.com/#!6/6e124/1

提前致谢

最佳答案

SELECT date, time, custom_id, Number
FROM traffic t
WHERE CONCAT(date, ' ', time) BETWEEN '01/06/2014 00:00' AND '01/10/2014 23:00'
AND Number =
(SELECT MAX(CAST(Number as smallint)) FROM traffic WHERE t.date = date and t.custom_id = custom_id)
ORDER BY date, CAST(Number as smallint) DESC, custom_id

关于MySQL 查询到 MS SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21704466/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com