当前位置:首页 » 编程语言 » 交叉表sql

交叉表sql

发布时间: 2022-06-26 23:39:26

㈠ 这个sql Server 交叉表查询 怎么实现

select c.CustomerName,o.ProctName,SUM(o.SaleNum)
from Customer as c
left join OrderList as o
on o.CustomerNo=c.CustomerNo
group by c.CustomerName,o.ProctName

㈡ SQL中的交叉表查询,来个稍微复杂点的例子吧

select d.name as clientname,c.prono,sum(a.ck_kg) as ck_kg,sum(a.ck_pcs) as ck_pcs,0 as fd_kg,0 as fd_pcs,trunc(b.docdate) as docdate from pl_cpch_line a
join pl_cpch b on A.CPCH_ID=b.cpch_id
join v_pl_scrk_line c on a.scrk_line_id=c.scrk_line_id
join bd_client d on b.client_id=d.client_id
group by d.name,c.prono,b.docdate

够复杂了吧

㈢ 怎么用SQL语句写交叉表啊

select a.学号,a.姓名,a.成绩 flash成绩,b.成绩 dw成绩,c.成绩 asp成绩
from 表 a left join 表 b on a.学号=b.学号 and a.课程名>b.课程名
left join 表 c on a.学号=c.学号 and a.课程名>c.课程名
and b.课程名>c.课程名
where c.成绩 is not null

㈣ sql 交叉表是个什么概念

就是笛卡尔积啊!R表x行n列,S表y行m列,得到的交叉表是x*y行,(m+n)列

㈤ sql交叉表写法,出考勤报表

--我写下我的思路吧--
--先取工号姓名,如果考勤表.EMPLOYEEID=员工表.employeeID,则--
selectb.employeeno工号,b.name姓名fromattena,employeeb
wherea.employeeid=b.employeeID--假设考勤表是atten--
--------------------------------------
--行转列,将1号到30号,从IN_TEIM、OUT_TIME中获取
select
if(IN_TIMElike'01.11%',RIGHT(IN_TIME,5),null)as'1号上班'
if(OUT_TIMElike'01.11%',RIGHT(OUT_TIME,5),null)as'1号下班'
fromATTENgroupbyIN_TIME,OUT_TIME


--如何实现将多个数值写到一个字段中,还需要再研究下。大体思路就这这样。--

㈥ 两表关联的分组的交叉表,如何使用sql语句完成。目标如下图

SELECT
*
FROM
(
SELECT
t1.km, t1.[year], t2.[user], t2.[money]
FROM
#t1 t1 JOIN #t2 t2
ON (t1.id = t2.fid)
) subQuery
PIVOT(
SUM(subQuery.[money])
FOR subQuery.[year] IN ([2008], [2009], [2010] )
) tmp
order by
1

㈦ sql语句 交叉表问题

后面加个group by 语句就好了,如下:
group by 工号;

热点内容
php一键环境 发布:2025-08-25 20:20:34 浏览:161
无油螺杆式空气压缩机 发布:2025-08-25 20:16:06 浏览:815
python文件到输出到文件 发布:2025-08-25 20:15:58 浏览:133
python打印日志 发布:2025-08-25 19:37:00 浏览:413
vr哪个配置最好 发布:2025-08-25 19:36:51 浏览:836
解压挤痘视频 发布:2025-08-25 19:34:31 浏览:310
老鼠脚本是什么意思 发布:2025-08-25 19:27:59 浏览:476
androidlongstring 发布:2025-08-25 19:25:00 浏览:495
app制作androidstudio 发布:2025-08-25 19:14:12 浏览:242
hibernate连接数据库 发布:2025-08-25 18:55:37 浏览:720