随笔分类 -  sql

世界可以没有python ; 但是不能没有sql
摘要:将table_1表中的数据,每个area的每个atype为A、B、C、D的数量统计出来。 重要的点: 1)pivot()里面for前面必须用聚合函数; 2)m字表中的每个字段都会在查询结果里面; ``` select * from (select area,atype from table_1) m 阅读全文
posted @ 2023-07-25 16:10 Shilo 阅读(61) 评论(0) 推荐(0)
摘要:select atype,name_list from ( select listagg(aname,',') within group( order by atype) name_list ,atype from listtable where age>0 group by atype) a; / 阅读全文
posted @ 2023-05-08 16:06 Shilo 阅读(1033) 评论(0) 推荐(0)
摘要:select regexp_substr(t.mywords , '[^,]+', 1, rownum,'i'), myid from (select myid,mywords from tablename where myid='12345') t connect by rownum <= LEN 阅读全文
posted @ 2023-05-05 10:09 Shilo 阅读(118) 评论(0) 推荐(0)