Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- (c.datefield) as dfield,
- (select
- count(t1.C_URI)
- from
- (select C_URI,MAX(C_updated) dataOpen from workitem wi where C_status<>'closed' and date(C_updated)<=c.datefield group by C_URI) t1
- left outer join
- (select C_URI,MAX(C_updated) dataClosed from workitem wi where C_status='closed' and date(C_updated)<=c.datefield group by C_URI) t2
- on
- t1.C_URI=t2.C_URI
- where
- t1.dataOpen> ifnull(t2.dataClosed,0)
- ) as tot
- from
- calendar c
- left join
- workitem
- on
- date(datefield)=date(C_updated)
- where
- datefield between ('2014-10-01') and ('2014-10-20')
- group by
- datefield;
- Error Code: 1054. Unknown column 'calendar.datefield' in 'where clause' 0.000 sec
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement