0
我有這個查詢後檢查各種教程應該工作 - 但它沒有。mysql php查詢包含加入計數
$query="SELECT week, year, COUNT(week) AS week_no
FROM archive_agent_booking
LEFT JOIN invoice_additions ON invoice_additions.week = archive_agent_booking.week
WHERE client_id='$account_no' GROUP BY week, year ORDER BY week DESC";
的表如下所示:
archive_agent_booking
+---------+----------+----------+----------+----------+---------+---------+
| job_id | week | year | desc | price | date | acc_no |
+---------+----------+----------+----------+----------+---------+---------+
invoice_additions
+---------+----------+----------+----------+----------+---------+
| acc_no | week | year | desc | am_price | am_date |
+---------+----------+----------+----------+----------+---------+
我基本上是想從兩個表中統計每個星期元素並將其顯示爲一個總即便一週值中的一個並不在一個顯示錶格。不知道這是否是最好的解決方案,所以我願意接受替代品。
什麼是你查詢的輸出? – ethrbunny
只是想出了set die()語句。 – Sideshow