java - mybatis中如何写mysql的union all 查询?
PHP中文网
PHP中文网 2017-04-18 10:32:02
0
2
917

mybatis如何写下边的sql?

select order_union.* from 
(select order_id, uid, amount, pay_type, pay_time time,'2016' ,'支付' as order_type from fl_pay_order where uid=1001639998 and status=1
UNION ALL 
select order_id, uid ,amount , null as pay_type, pay_time time ,'2017','提现' as order_type from fl_withdraw_order where uid=1001639998 and status=3)
as order_union
order by order_union.time desc limit 0,10
PHP中文网
PHP中文网

认证高级PHP讲师

全部回覆(2)
PHPzhong

select order_id, uid, amount, pay_type, pay_time time,'2016' as y,'支付' as order_type from fl_pay_order where uid=1001639998 and statusorder=1
UNION ALL 帶時間 ,'2017' as y,'提現' as order_type from fl_withdraw_order where uid=1001639998 and status=3

迷茫

雷雷

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!