gpt4 book ai didi

mysql - 我可以不使用 View 直接加入 SELECT 语句吗?

转载 作者:可可西里 更新时间:2023-11-01 07:33:43 25 4
gpt4 key购买 nike

是否可以在不创建 View 的情况下执行以下操作? IE。直接加入这些 SELECT?

CREATE VIEW temp_first AS SELECT MIN(DATE) AS mindate,id FROM mytable GROUP BY id
#
SELECT *, t.mindate FROM aggregate_analysis a
JOIN temp_first t
ON t.id = a.id
WHERE (.... )
ORDER BY mindate DESC

最佳答案

您应该能够用子查询/子选择替换选择中的 View 引用。

看看

有点像

SELECT  *, 
t.mindate
FROM aggregate_analysis a JOIN
(
SELECT MIN(DATE) AS mindate,
id
FROM mytable
GROUP BY id
) as t ON t.id = a.id
WHERE (.... )
ORDER BY mindate DESC

关于mysql - 我可以不使用 View 直接加入 SELECT 语句吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4204661/

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