here i can such example
create table estr
(
custo int,
product varchar(20),
val int,
billed_date datetime
)
insert into estr(custo,product,billed_date,value) values('10','Milk','2013-04-11','2000')
insert into estr(custo,product,billed_date,value) values('10','Milk','2013-04-21','500')
insert into estr(custo,product,billed_date,value) values('10','Milk','2013-05-05','100')
insert into estr(custo,product,billed_date,value) values('10','Milk','2013-05-11','2000')
insert into estr(custo,product,billed_date,value) values('10','fruits','2013-05-11','500')
insert into estr(custo,product,billed_date,value) values('30','fruits','2013-04-11','2000')
insert into estr(custo,product,billed_date,value) values('30','fruits','2013-05-11','1000')
My expecting output
custo product value no.of.mon(bil_months)
10 milk 4600 2
10 fruits 500 1
30 fruits 3000 2
above example custo=10 milk has billed various date of april,may but when i count the month ll show only 2
how to do that?