mdsk.net
当前位置:首页 >> SQL A列相同 B列相同 C列平均值 >>

SQL A列相同 B列相同 C列平均值

可以

select * from ( select id,code,name,ROW_NUMBER() over(PARTITION by code order by name) as num from tablename ) T where T.num

试试看 同xf_storecode,同xf_contractdesc,同xf_leasemode进行集合处理 select a.xf_storecode, b.xf_contractdesc, a.xf_tendercode, sum(a.xf_payamount), b.xf_leasemode from xf_transsalestender a, xf_bscontracth b where a.xf_storeco...

A列种类数=SUMPRODUCT(1/COUNTIF(A1:A5,A1:A5)) B列种类和=SUMPRODUCT(B1:B5/COUNTIF(A1:A5,A1:A5)) C列和=SUM(C1:C5)

select (case when a>b then a else b end), (case when b>c then b esle c end) from table_name

建表 create table t(a int,b int)insert into t values (1,2)insert into t values (2,3)执行 select a,b,case when b in (select a from t) then 1 else null end from t结果

您好: 语句如下,请参考,未测试。 UPDATE 表1 SET 表1.D=表2.C FROM 表1 LEFT JOIN 表2 ON 表1.A=表2.B

select a,b,c,count(*) as 重复记录 from 表 group by a,b,c

select case when first_name>middle_name then case when first_name>last_name then first_name else last_name end else case when middle_name>last_name then middle_name else last_name end end as name from member

select * from 表 where AA like '%a%' union select * from 表 where AA like '%b%' union select * from 表 where AA like '%c%'

网站首页 | 网站地图
All rights reserved Powered by www.mdsk.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com