gpt4 book ai didi

sql - SELECT AS 问题

转载 作者:行者123 更新时间:2023-12-03 18:27:39 24 4
gpt4 key购买 nike

我尝试执行以下查询:

SELECT t1.[user1], t1.[user2],
(CAST(t1.[total_event_duration] AS DECIMAL)) / (CAST (t2.[total_events_duration] AS DECIMAL)) AS buddy_strength
FROM [CDRs].[dbo].[aggregate_monthly_events] AS t1
INNER JOIN [CDRs].[dbo].[user_monthly_stats] AS t2
ON t1.[user1] = t2.[user1]
WHERE buddy_strength > 0.02

但它返回错误“无效的列名'buddy_strength'”

有谁知道如何解决上面的查询?

最佳答案

SELECT * 
FROM
(
SELECT
t1.[user1], t1.[user2],(CAST(t1.[total_event_duration] AS DECIMAL))/(CAST (t2.[total_events_duration] AS DECIMAL)) AS buddy_strength
FROM [CDRs].[dbo].[aggregate_monthly_events] AS t1
INNER JOIN [CDRs].[dbo].[user_monthly_stats] AS t2
ON t1.[user1] = t2.[user1]


) foo
WHERE foo.buddy_strength > 0.02

关于sql - SELECT AS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3997344/

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