gpt4 book ai didi

sql - 列的不同值

转载 作者:行者123 更新时间:2023-11-29 14:06:33 26 4
gpt4 key购买 nike

我有很多单个地址,其中有不同的 Sq_ft 值(这不应该是这种情况)。我想解析同一地址的 Sq_Ft 具有不同值的列。我可以在 where 子句中添加什么来帮助我这样做?我曾尝试使用 Sq_ft 添加不同的语法,但徒劳无功。

例子:

Address of New Home                      Sq_Ft
1234 Obama Drive 2,578
1234 Obama Drive 2,586

select "Address_of_New_Home","Sq_Ft"
from "Amazon".salesdatapcr
where "Sq_Ft" <>
order by 1

最佳答案

使用 EXISTS 运算符和相关子查询:

select "Address_of_New_Home","Sq_Ft"
from "Amazon".salesdatapcr t1
where EXISTS (
SELECT null from "Amazon".salesdatapcr t2
WHERE t1."Address_of_New_Home" = t2."Address_of_New_Home"
and t1."Sq_Ft" <> t2."Sq_Ft"
)
order by 1

关于sql - 列的不同值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41448712/

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