我有一个查询:
SELECT `gigs`.*, COUNT(`signups`.`signupID`) AS `signupsPending` FROM `gigs` NATURAL JOIN `signups` WHERE (`signupStatus` = 4) GROUP BY `gigID`
那是查询一个看起来像这样的数据库:
+-------+---------+------------+
| gigID | gigName | gigDate |
+-------+---------+------------+
| 1 | Foo | 01/01/2014 |
+-------+---------+------------+
| 2 | Bar | 16/01/2014 |
+-------+---------+------------+
+----------+-------+--------------+--------------+
| signupID | gigID | signedUserID | signupStatus |
+----------+-------+--------------+--------------+
| 1 | 1 | 1 | 1 |
+----------+-------+--------------+--------------+
| 2 | 1 | 2 | 4 |
+----------+-------+--------------+--------------+
| 3 | 1 | 3 | 2 |
+----------+-------+--------------+--------------+
| 4 | 2 | 1 | 2 |
+----------+-------+--------------+--------------+
但是当我执行上面的查询时,它只显示 gigID = 1 的一行。我怎样才能改变上面的查询,以便它在行的其余部分显示 0?