gpt4 book ai didi

mysql - 在查询中使用已选择的单元格

转载 作者:行者123 更新时间:2023-11-29 14:16:09 25 4
gpt4 key购买 nike

我想知道我在 MySQL 中是否有可能使用我之前在查询中所做的选择来制作数学语句?例如:

SELECT
t.date as the_date,
TIMETODIFF(the_date, NOW()) as date_diff,
t.time_interval as t_interval,
(date_diff / t_interval) as intervals_left
WHERE
something = something
ORDER BY
something DESC

我的问题是,我不能使用名称,我给出选择。例如,当我使用“the_date”来计算 date_diff 时,它显示“未知列”。

最佳答案

您不能再次在该部分的 select 部分中使用您定义的别名。您可以在查询的 where 部分或其他后续部分中使用它。

关于mysql - 在查询中使用已选择的单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12638642/

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