Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009

    Unanswered: Selecting split period of date and time

    select * from table where datetime between '.....' and '.....'

    now i split it up datetime format in my user-interface and display year,month,day,hour,minute,second using select query.
    select DATE_FORMAT(datetime,'%Y') as Year -(similarly for Month and Day)
    select TIME_FORMAT (datetime,'%H') as Hour- (similarly for Minute and Second)

    how to use the same 'select * from table where .......(what to write??) between ........(so-and-so Year,Month,Day,Hour,Minute,Second) and .......(and so-and-so Year,Month,Day,Hour,Minute,Second)' logic for these split values?

    help me!

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    you don't have to do it that way, just write the SQL using the DATETIME columns | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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