SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select statement

    I have a table as follows:

    Columns = id, date

    Data:

    Id - Date
    1 - 12-09-2011
    2 - 12-28-2011

    I need to do a select statement that will pull the amount of days between the two rows.

    Any ideas?

  2. #2
    Non-Member Max Height's Avatar
    Join Date
    Dec 2011
    Posts
    303
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by wickedneat View Post
    Any ideas?
    lots of ideas here

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by wickedneat View Post
    I need to do a select statement that will pull the amount of days between the two rows.
    do you mean those two rows specifically? the rows with id=1 and id=2?

    the actual date calculation is trivial

    matching up the two rows you want is going to be a wee bit trickier
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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