MySql query- return data that is not present in the past 12 months -


i have question. how write query? new mysql , confused sometimes. please me. thanks

"adult canadian members haven't accumulated @ xyz in past 12 months"

i try this: select individuals members country='ca' , acc_score = 'n' , reg_date> date_sub(current_date()-365);

you can use datediff() function,

accumulated within 12 months,

 select individuals members      country='ca'      , acc_score = 'n'      , datediff(reg_date,currdate()) between 0 ,  365; 

accumulated before 12 months,

 select individuals members      country='ca'      , acc_score = 'n'      , datediff(reg_date,currdate()) >  365; 

additional info datediff() here


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -