上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 57 下一页
摘要: 行转列: 多行转多列 列转行:多列转多行 以下转自:https://www.cnblogs.com/xiaoxi/p/7151433.html 一、行转列 即将原本同一列下多行的不同内容作为多个字段,输出对应内容。 建表语句 插入数据 查询数据表中的内容(即转换前的结果) 先来看一下转换后的结果: 阅读全文
posted @ 2019-06-13 13:42 毛会懂 阅读(1095) 评论(0) 推荐(0) 编辑
摘要: 列转行: 多列转多行 行转列:多行转多列 以下转自:https://www.cnblogs.com/ClassNotFoundException/p/6860615.html 列转行:利用max(case when then) SELECT `name`, MAX( CASE WHEN course 阅读全文
posted @ 2019-06-13 13:14 毛会懂 阅读(1238) 评论(0) 推荐(0) 编辑
摘要: SELECT base.* from(select id_no,COUNT(*) from aim.aim_t_cust_base GROUP BY id_no HAVING COUNT(*) >1) as t left join aim.aim_t_cust_base base on t.id_n 阅读全文
posted @ 2019-06-12 14:52 毛会懂 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 实例1: SET @ID = 0; SELECT AVG(loan_amount) from ( SELECT @ID:=@ID+1 as ID, loan_amount FROM table_xxx ORDER BY loan_amount ) a where IF( ROUND(@ID/2,0) 阅读全文
posted @ 2019-06-12 11:37 毛会懂 阅读(240) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/Tim_phper/article/details/78344444 阅读全文
posted @ 2019-06-06 09:54 毛会懂 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 参考: https://blog.csdn.net/wuseyukui/article/details/72627667 order by示例 示例数据: Case 1 Case 2 Case 3 Case 4 结论:order by子句,尽量使用Index方式排序,在索引列上遵循索引的最佳左前缀原 阅读全文
posted @ 2019-06-06 09:05 毛会懂 阅读(905) 评论(0) 推荐(0) 编辑
摘要: 我们常用的IN 操作是这样的: select * from tab twhere t.col1 in ('value1''value2');12但是如果是多个列的取值来自同一个子查询呢? 我们是不是要这样写了? select * from tab1 t1where t1.col1 in (selec 阅读全文
posted @ 2019-06-05 13:31 毛会懂 阅读(8035) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/xiesq5112/article/details/52154169 阅读全文
posted @ 2019-06-05 13:31 毛会懂 阅读(571) 评论(0) 推荐(0) 编辑
摘要: Subquery returns more than 1 row表示子查询返回了多行数据 例如: select * from table1 where table1.colums=(select columns from table2) 解决方法 select * from table1 where 阅读全文
posted @ 2019-06-05 13:30 毛会懂 阅读(6465) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/zzzgd_666/article/details/81101548 阅读全文
posted @ 2019-06-03 18:56 毛会懂 阅读(2739) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 57 下一页