Results 1 to 7 of 7

Thread: Help!!!

  1. #1
    Join Date
    Mar 2012
    Posts
    7

    Red face Unanswered: Help!!!

    Heloo
    i need help please!
    Well, i have simple table..

    | ID | DateVal |
    --------------------------------
    | 4971 | 17.10.2008. 13:30:40 |
    --------------------------------
    | 4972 | 27.10.2008. 21:56:51 |
    -------------------------------
    | 4973 | 27.10.2008. 22:30:28 |
    --------------------------------
    | 4974 | 28.10.2008. 0:01:53 |
    ------------------------------
    | 4975 | 28.10.2008. 0:03:23 |
    -------------------------------
    | 4976 | 28.10.2008. 0:04:50 |
    |------------------------------
    | 4977 | 29.10.2008. 4:24:10 |
    -------------------------------
    | 4978 | 29.10.2008. 4:30:51 |
    ------------------------------
    | 4979| 29.10.2008. 4:36:00 |

    I need query that will use all records from single day and put it in excell file.
    Records need put in same excel but in diferent sheet.
    Help

  2. #2
    Join Date
    Aug 2004
    Location
    Dallas, Texas
    Posts
    831
    Show us what code you have so far.

  3. #3
    Join Date
    Mar 2012
    Posts
    7
    i dont have any code, that is problem! I don't have any idea how to resolve this problem!

  4. #4
    Join Date
    Aug 2004
    Location
    Dallas, Texas
    Posts
    831
    Start by writing some code, try it out, and if you still have a problem then post what you've written so far.

  5. #5
    Join Date
    Mar 2012
    Posts
    7
    ok, have you any advice how to start? set focus on what etc??
    Help please..

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Two options: truncate the dateval field to give you only the date portion or use a calendar table! You will have to do your own performance testing to determine which method is most efficient for you. But remember, just because the code is shorter, doesn't necessarily mean it is better

    Calendar method
    See this thread for code to create both a numbers and calendar table.

    Then you can join your table to this calendar table to give you a way of grouping by day, something like this
    Code:
    SELECT your_table.id
         , your_table.dateval
         , calendar.the_date
    FROM   your_table
     INNER
      JOIN dbo.calendar
        ON your_table.dateval >= calendar.the_date
       AND your_table.dateval <  DateAdd(dd, 1, calendar.the_date)
    Date truncation
    See this recent thread: http://www.dbforums.com/microsoft-sq...ml#post6542882
    Last edited by gvee; 03-16-12 at 11:37.
    George
    Home | Blog

  7. #7
    Join Date
    Mar 2012
    Posts
    7
    Thanks a lot!
    I will try to do so!
    if i faill you will know :-)

Posting Permissions

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