Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下查询: SELECT TIMESTAMPDIFF(HOUR, timestam, NOW()) AS HoursDifference
此返回时差例如 0、1、2、3。
我需要帮助编写一个 SQL 查询,该查询将花费这一小时并将其从 48 中减去,给出 48、47、46 或 45 的答案。
假设它给出了这个输出:
HoursDifference
0 1 2 8
如何获得以下输出?:
48 47 46 40
谢谢,
SELECT (48 - TIMESTAMPDIFF(HOUR, timestam, NOW())) AS HoursDifference
你是这样问的吗