views:

38

answers:

0

I need to use SQL SERVER to try for it and then generate a crystal report out. who can teach me how to make it as the pattern i show in?

Daily Registration / Activation Report As Of 12/10/2009

 Year : 2009     

 Month : ALL                       



      Registration        Activation Port Out
Month Imported Activated Imported 
Jan            0    0                0 0

Feb            0    0                0 0

Mar         1360   571               782 0
.             .
.             .
.             .
.             .
.                
.
.

Total for 
2009     95922  55667             86646 1969





Daily Registration / Activation Report As Of 12/10/2009

 Year :2009     

 Month :JAN                            





        Registration       Activation Port Out
Date Imported Activated Imported 
01/01/2009 0 0             0           0
02/01/2009 0 0             0           0
03/01/2009 0 0             0           0
04/01/2009 0 0             0           0
05/01/2009 0 0             0           0
06/01/2009 0 0             0           0
07/01/2009 0 0             0           0

Total for 
Jan 2009 0 0             0           0

BELOW THAT IS THE SYNTAX MY SENIOR GIVE ME.

Daily Registration/Activation Report
====================================

1. Year Summary

''''get registration
select Year(reg_date) as regYear, count(*) as regCount from dailyregistration
group by Year(reg_date) 
order by Year(reg_date) 

''''get same day activation
select Year(reg_date) as regYear, count(*) as regCount from dailyregistration 
where reg_activationdate = reg_date 
group by Year(reg_date) 
order by Year(reg_date) 

'''''get activation
select Year(act_date) as actYear, count(*) as actCount from dailyactivation
group by Year(act_date)
order by Year(act_date)

''''get port out by year
select Year(prt_completed) as prtYear, count(*) as prtCount from dailyPortOut 
where prt_status = 'COMPLETED' 
group by Year(prt_completed) 
order by Year(prt_completed) 

2. Month Summary

''''get registration
select Month(reg_date) as regMonth, count(*) as regCount from dailyregistration 
where Year(reg_date) = @prmYear 
group by Month(reg_date) 
order by Month(reg_date) 

''''get same day activation
select Month(reg_date) as regMonth, count(*) as regCount from dailyregistration 
where Year(reg_date) = @prmYear 
and reg_activationdate = reg_date 
group by Month(reg_date) 
order by Month(reg_date) 

'''''get activation
select Month(act_date) as actMonth, count(*) as actCount from dailyactivation 
where Year(act_date) = @prmYear 
group by Month(act_date) 
order by Month(act_date) 

''''get port out by year
select Month(prt_completed) as prtMonth, count(*) as prtCount from dailyPortOut 
where Year(prt_completed) = @prmYear 
and prt_status = 'COMPLETED' 
group by Month(prt_completed) 
order by Month(prt_completed)