我想做这样的事情:
SELECT locations.id, places.id, scannables.id, SUM(scannables.available)
FROM `scannables`
INNER JOIN places ON scannables.place_id = places.id
INNER JOIN locations ON places.location_id = locations.id
WHERE locations.id = 2474 AND scannables.bookdate
BETWEEN '2009-08-27' and date_add('2009-08-27', INTERVAL 3 DAY)
AND SUM(scannables.available) >= 3
GROUP BY scannables.place_id
这有效......除了“AND SUM(scannables.available)> = 3”
我不知道如何让它工作,