MYSQL查询的一个结果?

时间:2014-09-21 21:24:01

标签: php mysql

我有这张桌子

订单

  • orders_id
  • order_article_id
  • order_invoice_id
  • order_customer_id
  • order_qty

制品

  • articles_id
  • article_name
  • article_qty
  • article_price
  • article_amount

客户

  • customers_id
  • customer_name
  • customer_position
  • customer_office

发票

  • invoices_id
  • 日期
  • invoice_customer_id

和SQL Join Table

$sql="SELECT customer_name, invoices_id, SUM( order_qty * article_price ) AS amount, article_name
FROM orders
LEFT JOIN articles ON order_article_id = articles_id
LEFT JOIN invoices ON order_invoice_id = invoices_id
LEFT JOIN customers ON order_customer_id = customers_id
WHERE invoices_id =1
GROUP BY customer_name, invoices_id
LIMIT 0 , 30"

这样我得到了结果

  • customer_name
  • invoices_id
  • 金额
  • ARTICLE_NAME

问题在于article_name?我有几个文章名称,但我只获得了第一个结果?

0 个答案:

没有答案