+ Post New Thread
Results 1 to 6 of 6
Coding Thread, SQL graph fun in Coding and Web Development; I am trying to pull out data from our till system as follows: Number of sales between 12pm and 2pm, ...
  1. #1

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,608
    Thank Post
    514
    Thanked 2,441 Times in 1,889 Posts
    Blog Entries
    24
    Rep Power
    831

    SQL graph fun

    I am trying to pull out data from our till system as follows:

    Number of sales between 12pm and 2pm, grouped by the day they happened.

    I then want to use this to display on a graph in Microsoft Reporting Services, so the results need to be in pairs - the number, and the date in question.

    Now, my question is, how do I do this grouping? I can do the 'between' part I think

    Code:
    WHERE DATEPART(hh,DateColumn) BETWEEN 12 AND 14
    But the grouping is being a little more elusive, as there will be more than one Day '1' and I don't want these stuck together too.

  2. #2

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,608
    Thank Post
    514
    Thanked 2,441 Times in 1,889 Posts
    Blog Entries
    24
    Rep Power
    831
    Ok, answering this myself, I can do it using the DATEPART(dy, DateColumn) instead, and then limit it down to a specific date range (eg. year)

  3. #3

    GREED's Avatar
    Join Date
    Mar 2008
    Location
    Portsmouth
    Posts
    2,968
    Thank Post
    367
    Thanked 359 Times in 293 Posts
    Blog Entries
    8
    Rep Power
    173
    So Day 1 is Monday? Why not group by the date, a singular figure, and just include the attached day (if needed)

  4. #4

    GREED's Avatar
    Join Date
    Mar 2008
    Location
    Portsmouth
    Posts
    2,968
    Thank Post
    367
    Thanked 359 Times in 293 Posts
    Blog Entries
    8
    Rep Power
    173
    Or that

  5. #5

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,608
    Thank Post
    514
    Thanked 2,441 Times in 1,889 Posts
    Blog Entries
    24
    Rep Power
    831
    The problem I have is the system uses DateTime columns, rather than Date columns, so I have to work around that.

  6. #6

    GREED's Avatar
    Join Date
    Mar 2008
    Location
    Portsmouth
    Posts
    2,968
    Thank Post
    367
    Thanked 359 Times in 293 Posts
    Blog Entries
    8
    Rep Power
    173
    I understand, yes I think you are on right lines

SHARE:
+ Post New Thread

Similar Threads

  1. how to display a graph of 16000 samples
    By tinmanjo in forum Office Software
    Replies: 2
    Last Post: 1st July 2010, 12:31 PM
  2. [MS Office - 2007] Automatic Graph in Excel
    By cgiuk in forum Office Software
    Replies: 2
    Last Post: 19th May 2010, 08:58 AM
  3. [CLOSED] Missing Content: PM usage graph
    By FN-GM in forum EduGeek.net Site Problems
    Replies: 2
    Last Post: 9th April 2010, 09:33 AM
  4. graph data on apache
    By CyberNerd in forum *nix
    Replies: 5
    Last Post: 5th November 2008, 01:25 PM
  5. [MS Office - 2007] Graph labels
    By imiddleton25 in forum Office Software
    Replies: 1
    Last Post: 10th September 2008, 03:25 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •