Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Selecting data between twodates??

Selecting data between twodates??

Scheduled Pinned Locked Moved Database
databasequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ron S
    wrote on last edited by
    #1

    Hello all I am writing the query to select values between two dates. My query is Select * from Table1 where date_sent between '25-Jul-07 12:00:00' and '01-aug-07 12:00:00' this is not retrieving me any data as there are some entries between those dates in the table. i had tried using >=25-Jul-07 and <=02-aug-07 ' but this is fetching me 25th and 26th july data which is not supposed to be happened. did i miss something which is very important in the query. thanks in advance.

    Bharath.S Ron

    B 1 Reply Last reply
    0
    • R Ron S

      Hello all I am writing the query to select values between two dates. My query is Select * from Table1 where date_sent between '25-Jul-07 12:00:00' and '01-aug-07 12:00:00' this is not retrieving me any data as there are some entries between those dates in the table. i had tried using >=25-Jul-07 and <=02-aug-07 ' but this is fetching me 25th and 26th july data which is not supposed to be happened. did i miss something which is very important in the query. thanks in advance.

      Bharath.S Ron

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Select * from Table1 where date_sent >= convert(varchar, (convert(datetime,'25-Jul-07 12:00:00')),102) and date_sent <= convert(varchar, (convert(datetime,'01-aug-07 12:00:00')),102)


      I Love SQL

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups