sql - MySQL having if -
sql - MySQL having if -
i'm having problem mysql query. if label "5" want records there more 10 of them current day, number of rows other labels. best way accomplish in query?
select id,name,label,date items grouping date('date'), label having count(id) > 10 if label = 5
i in single query:
select id, name, label, date items date >= date(now()) , date < date(now()) + interval 1 day grouping label having (count(id) > 10 , label = 5) or (label <> 5); this seems simplest method.
mysql sql having having-clause
Comments
Post a Comment