reporting - SQL Server query -


I have a SQL Server DB that has a registration table which I need to plot over a graph with time. It is that I need to break it down from where users registered (such as website, WAP site, or mobile application).

The resultant output data should look like this ...

  [date] [num_reg_website] [num_reg_wap_site] [num_reg_mobileapp] 1Feb 2010,24,35,64 2Feb 2010,23,85,48 3Feb 2010,29,37,79  

etc ...

The source table is as follows ...

UUID (int), signupdate (data time), requestource (varchar (50))

Some desperate data in this table looks like this ...

  1001,2010-02-2: 00: 12: 12, 'Website' 1002,2010 -02-2: 00: 10: 17, 'App' 1003,2010-02-3: 00: 14: 19, ' Website '1004,2010-02-4: 00: 16: 18,' WAP '1005, 2010-02-4: 00: 18: 16,' Website ' 

Low A data column returns 'Total Registration' for website registration by running a query, but I'm not sure how to do this for multiple columns unfortunately ....

  Cast (flo CAST (select as [signupdate] AS flot) [Signupday], as [signupdate], counting (UUID) total registration '[UserRegistrationRequests] WHERE request =' Website 'Group by CAST (FLOOR (CAST) (Float as [signupdate]) AS DATETIME)  

It seems that you have two problems, the first date is the only way to change the date. Since you have not specified which version of SQL Server, I am assuming that it is SQL Server 2005 and earlier. For this, I usually use the debt def move, where I get the number zero days of the day and then put in the form of a datetime. Like other era production producing crosstab As the date (date, time), date (as datedfif (d, [signupdate]] [date], sum (case when request = 'website' as Num_reg_website, then (case when the requestource = 'Wap' then 1 other zero end) as num_reg_wap_site, sum (episode when requested = 'mobileapp' then 1 other zero) as the end num_reg_mobileapp [UserRegistrationRequests] by group < P> If you are using SQL Server 2008, you can take advantage of its date data type and something like Answer: Select

  as [[signupdate] date], in the form of [date], yoga (case when requested = 'website' then 1 other zero) finally num_reg_website, sum ([Signupdate]] date by num_reg_mobileapp [UserRegistrationRequests] group as the end (case when requestource = 'wap' then 1 other 0 end) as num_reg_wap_site, sum (case when requestource = 'mobileapp' then 1 other zero) AS)  

Comments