mysql全连接的使用

 时间:2024-11-04 16:53:44

1、<select id="getlistPageTotalByTime" resultType="pd"> SELECT * FROM (SELECT a.ptregist_num AS num, a.pt_name AS pt_name, SUM(a.number)-SUM(a.recount) AS pttotal FROM pt_purchase a WHERE 1=1 <if test="pd.startTime != '' and pd.startTime != null"> and a.jh_date &gt; #{pd.startTime} </if> <if test="pd.endTime != '' and pd.endTime != null"> AND a.jh_date &lt; #{pd.endTime} </if> GROUP BY a.ptregist_num ) AS pt

mysql全连接的使用

3、UNION SELECT * FROM(SELECT c.ptregist_num num,c.pt_name AS pt_name,SUM(c.number)-SUM(c.recount) AS pttotalFROM pt_purchase c WHERE 1=1<if test="pd.startTime != '' and pd.startTime != null">and c.jh_date &lt; #{pd.startTime}</if><if test="pd.endTime != '' and pd.endTime != null">AND c.jh_date &gt; #{pd.endTime}</if> GROUP BY c.ptregist_num ) AS pt1

mysql全连接的使用

5、MySQL不支持全外连接,所以只能采取关键字UNION来联合左、右连接的方法达到目的;<select id="getSeedSellTotalByType" resultType="pd"> SELECT a.vt_name AS name, a.unitcode AS unitcode , SUM(a.number)-SUM(a.recount) AS VALUE FROM seedledger a WHERE 1=1 <if test="startTime != '' and startTime != null"> and a.saledate &gt; #{startTime} </if> <if test="startTime != '' and startTime != null"> and a.saledate &lt; #{endTime} </if> GROUP BY a.unitcode </select>

mysql全连接的使用

7、mybatis中常用的方法

mysql全连接的使用
  • 艾尔登法环红狮子城在哪
  • 艾尔登法环灵依墓地铃兰怎么获得
  • 艾尔登法环龙心位置一览
  • 《艾尔登法环》熔炉羽护符怎么获得
  • 艾尔登法环无头骑士露提尔骨灰在哪获得
  • 热门搜索
    怎么开淘宝 cad角度线怎么画 辞退员工怎么说 微信账单怎么查 眼皮跳是怎么回事 怎么做图 热干面怎么做 咸鸭蛋怎么做 自动挡汽车怎么开 发展规划怎么写