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

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

uid=1001639998およびstatus=1のfl_pay_orderからorder_id、uid、amount、pay_type、pay_time time、'2016'、order_typeとして'支付'を選択します
UNION ALL
pay_type、pay_timeとしてorder_id、uid、amount、nullを選択しますtime、'2017' を y、'提现' を order_type (fl_withdraw_order から) (uid=1001639998、status=3)

いいねを押す +0
迷茫

リーリー

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!