摘要:
With语句可以在查询中做成一个临时表/View,用意是在接下来的SQL中重用,而不需再写一遍。 With Clause方法的优点: 增加了SQL的易读性,如果构造了多个子查询,结构会更清晰。 示例: with soloemp as (select distinct salary from hy_e 阅读全文
摘要:
解法1:这是日本人MICK在其著作《SQL进阶教程》里提出的方法: select avg(distinct salary) from ( select t1.salary from tb_employee t1,tb_employee t2 group by t1.salary having sum 阅读全文