Vinny Gullotta wrote:

> So I have this code I'm working with (pasted below) that queries a
> mysql db table called timetracking. The goal of the page is to search
> the db for all data based on a certain engineer, sorted by product and
> it takes pre-defined values based on actions performed, sums them
> based on product and display's the percentage of time an engineer has
> spent on each product. Everything works great except I need to limit
> the results to the last months data only, but everything I try seems
> to just break it. Can anyone push me in the right direction a little?

I can't see a timestamp field in your code, but I'm assuming you've got
one? 

SELECT *,SUM(timespent) FROM timetracking 
WHERE engineer=<engineer> AND
month(timestamp)=month(date_sub(now(),interval 1 month))
GROUP BY product;


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to