举个栗子,我有一个表金额表,t_money 我需要拿到1年内最高的金额,则
SQL: select max(money) from t_money where 最近一年;
同时,我需要拿到最近一个季度最高的金额
select max(money) from t_money where 最近一季度;
这样子写实在很粗暴,查两次表,如果多个条件,要各种写sql.一点都不优雅。如何只查一次表完成这个效果
举个栗子,我有一个表金额表,t_money 我需要拿到1年内最高的金额,则
SQL: select max(money) from t_money where 最近一年;
同时,我需要拿到最近一个季度最高的金额
select max(money) from t_money where 最近一季度;
这样子写实在很粗暴,查两次表,如果多个条件,要各种写sql.一点都不优雅。如何只查一次表完成这个效果