SQL语句(虚拟表),计算今日收入、本月收入、上月收入

根据时间区间计算今日(00.00.00到23.59.59)收入、本月(月初00.00.00~月末的23.59.59)收入、上月收入(同理) todayInco

根据时间区间计算今日(00.00.00到23.59.59)收入、本月(月初00.00.00~月末的23.59.59)收入、上月收入(同理)

todayIncome(今日收入)
incomeMonth(本月收入)
lastIncomeMonth(上月收入)
计算金额总和: sum(金额字段)
重点!!!
mybatis xml文件 mybatis不能直接 小于等于的写法 <=
在这里插入图片描述

大于等于
= ]]>
小于等于

最终结果如下:

        SELECT Day.todayIncome,Month.incomeMonth,LastMonth.lastIncomeMonth from  g_shop_store_order aLEFT JOIN (SELECT sum(pay_amount) as todayIncome from g_shop_store_order  where create_times = ]]&g