我有两张这样的桌子
Invoice (invoice_no, invoice_date, customer_id, ...),
Customers (customer_id, customer_name, ...)
现在我要做的是列出按客户名称排序的发票。
SELECT b.customer_name, a.*
FROM Invoice a, Customers b
WHERE a.customer_id=b.customer_id
ORDER BY b.customer_name
但是这个 sql 的问题是,如果有发票没有customer_id
,我怎么能先列出这些发票,然后customer_id
按customer_name
asc 列出发票。