View Single Post
Old 09-23-2011, 11:05 AM   #3 (permalink)
core1024
The Wanderer
 
Join Date: May 2010
Posts: 19
Thanks: 1
core1024 is on a distinguished road
Default

This two queries can be easely merged in to one.
Quote:
Originally Posted by hmonkey89 View Post
select * from stocklevel where jobID = $jobID GROUP BY catID
then for each
count(*) from stock where catID = $catID
Code:
SELECT stocklevel.*, COUNT(catID) AS numCats
FROM stocklevel
LEFT JOIN stock USING(catID)
WHERE jobID = '$jobID' GROUP BY catID
But English is not what I am best at and I couldn't understand what are you trying to do with the dates
Quote:
Originally Posted by hmonkey89 View Post
get all dates between startdate and enddate
startdate and enddate of stocklevel or jobs? What do you want to compare this dates with?
core1024 is offline  
Reply With Quote