Yes is the quick answer . It's just about the order that you call the 'HAVING' or 'WHERE' up.
Have a look at this webpage How to call up HAVING and WHERE in the same MYSQL query
So with the following statement
select id, user_id, cdate, start_time, end_time, count(*)
from vfvi7_pf_time_tracking
group by user_id, cdate
having count(*) >1
I cannot put my WHERE clause at the end but need to put it before the GROUP BY; like this
select id, user_id, cdate, start_time, end_time, count(*)
from vfvi7_pf_time_tracking
WHERE dShftChked !=1
group by user_id, cdate
having count(*) >1
No comments:
Post a Comment