tbl_users
u_id | u_type | u_first_name
1 U I_am_user
2 E I_am_emp
3 E I_am_emp2
tbl_order
o_id | u_id | e_id | o_status | pay_status
1 1 0 pending Unpaid
2 1 2 pick Paid
3 1 0 pending Unpaid
4 1 3 Pick paid
我试过这个查询来显示用户和员工姓名
SELECT o.*, a.u_first_name as user, b.u_first_name as emp
FROM `tbl_order` AS o
LEFT JOIN tbl_users AS a ON a.u_id = o.u_id
LEFT JOIN tbl_users AS b ON b.u_id = o.e_id
o_id | u_id | e_id | user | emp | pay_staus
我们如何给条件(order by 或其他 1)先显示未付(pay_status
)记录然后e_id=0
记录然后全部休息?