我有3個MySQL表(訂單,營,用戶)爲波紋管的值,的MySQL得到最後2條記錄表有3個表
order_table
ID camp_id orderDate message
1 1 2015-01-01 ok
2 1 2015-02-01 ok
3 2 2015-03-01 not ok
4 3 2015-01-01 not ok
5 1 2015-04-01 not ok
6 2 2015-01-01 ok
7 3 2015-07-01 not ok
camp_table
camp_id camp_uid camp name
1 10 first camp
2 11 second camp
3 12 third camp
4 10 forth camp
user_table
uid uname
10 abc
11 xyz
12 wrt
我想有結果作爲波紋管
uname,camp name,message
通過orderDate存儲
最後2個記錄從order_table每個用戶爲今天爲了我想加盟SE表, E從camp_table和消息從order_table有UNAME從USER_TABLE和營南。 爲今天爲了通過orderDate存儲 感謝
請編輯並更詳細地解釋您的問題。 – FluxCoder
您想要訂購故事中最後2條記錄,並且您希望我們加入? –
請參閱http://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql-查詢 – Strawberry