Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 814605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:32:54+00:00 2026-05-15T01:32:54+00:00

I have a SQL Server DB containing a registrations table that I need to

  • 0

I have a SQL Server DB containing a registrations table that I need to plot on a graph over time.
The issue is that I need to break this down by where the user registered from (e.g. website, wap site, or a mobile application).

the resulting output data should look like this…

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

etc…

The source table is as follows…

UUID(int), signupdate(datetime), requestsource(varchar(50))

some smple 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'

Running the following query returns one data column ‘total registrations’ for the website registrations but I’m not sure how to do this for multiple columns unfortunatly….

select  CAST(FLOOR(CAST([signupdate]AS FLOAT ))AS DATETIME) as [signupdate], count(UUID)  as 'total registrations' FROM [UserRegistrationRequests] WHERE requestsource = 'website'
group by CAST(FLOOR(CAST([signupdate]AS FLOAT ))AS DATETIME)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:32:55+00:00Added an answer on May 15, 2026 at 1:32 am

    It sounds like there are two problems you are having. The first is how to convert the DateTime into a Date only value. Since you did not specify which version of SQL Server, I’m assuming it is SQL Server 2005 and prior. For that I typically use the DateDiff trick where I find the number of days from day zero and then cast that as a DateTime. The other trick is creating a crosstab like output.

    Select Cast(DateDiff(d, 0, [signupdate]) As DateTime) As [Date]
        , Sum( Case When requestsource = 'website' Then 1 Else 0 End ) As num_reg_website
        , Sum( Case When requestsource = 'wap' Then 1 Else 0 End ) As num_reg_wap_site
        , Sum( Case When requestsource = 'mobileapp' Then 1 Else 0 End ) As num_reg_mobileapp
    From [UserRegistrationRequests]
    Group By Cast(DateDiff(d, 0, [signupdate]) As DateTime)
    

    If you are using SQL Server 2008, you can take advantage of its Date data type and do something like:

    Select Cast([signupdate]) As Date) As [Date]
        , Sum( Case When requestsource = 'website' Then 1 Else 0 End ) As num_reg_website
        , Sum( Case When requestsource = 'wap' Then 1 Else 0 End ) As num_reg_wap_site
        , Sum( Case When requestsource = 'mobileapp' Then 1 Else 0 End ) As num_reg_mobileapp
    From [UserRegistrationRequests]
    Group By Cast([signupdate]) As Date)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 459k
  • Answers 459k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could probably store a list of colors in an… May 15, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer The simplest is just string filename = ... Thread thread… May 15, 2026 at 11:19 pm
  • Editorial Team
    Editorial Team added an answer $('tr').not('thead tr').addClass('selected') May 15, 2026 at 11:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.