Vandana

Vandana

  • 1.2k
  • 590
  • 76.2k

How to count total no of month between two dates

Oct 5 2016 5:52 AM

 I have a query to find out month between two dates ie between max(date) and min(date)
 
Mobile no can repeate suppose 2011-jan-01 to 2016-01-31 
the mobile no '9999111123' occur 9 times ,'9999211123' occur 6 times
 
then find out months difference
 
select distinct mobile,max(apptdate),min(apptdate),count(mobile) as [count]
from crm_leadtable
group by mobile
having count(mobile) >7
order by count desc 

Answers (2)