1
得到與分組兩個表的數據,我有兩個表幾乎相同的列,我想將它們合併和按日期
MySQL的:通過日期
表1分組:order_payments_detail
| payment_by | amount(as Debit in result) | added_on |
| Ali | 1000 | 2014-09-21 |
| Aslam | 2000 | 2014-09-25 |
| Akram | 4000 | 2014-09-28 |
表2:訂單
| cust_name | amount(as credit in result)| added_on |
| Shop1 | 1000 | 2014-09-22 |
| Shop2 | 2000 | 2014-09-26 |
| Shop3 | 4000 | 2014-09-29 |
結果會是這樣
| particulars| debit | credit | added_on |
| Ali | 1000 | null | 2014-09-21 |
| Shop1 | null | 1000 | 2014-09-22 |
| Aslam | 2000 | null | 2014-09-25 |
| Shop2 | null | 2000 | 2014-09-26 |
| Akram | 4000 | null | 2014-09-28 |
| Shop3 | null | 4000 | 2014-09-29 |
是的,我的意思是按日期排序thankyou非常多 – 2014-10-05 22:05:34