mysql - How to add date condition to my query? -


i have sql statement. works, , need add 1 condition. need sort date. occurence - date row.

select dd.caption, count(t.occurence)  transaction t    inner join dict_departments dd     on dd.id = t.terminal_id group dd.caption 

how add condition:

where t.occurence between (current_date() - interval 1 month) 

to query.

between requires 2 arguments, start point , end point. if end point current time, have 2 options:

  1. using between:

where t.occurence between (current_date() - interval 1 month) , now()

  1. using simple comparison operator:

where t.occurence >= (current_date() - interval 1 month)


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -