Jump to content

Problem with getting records between two dates


jbpunjabi

Recommended Posts

Select

item_id,

customer_name,

DATE_FORMAT(picked_up_date,\'%D %M, %Y\' pickedUp_date

from

jb_inventory

where

(picked_up_date >=1/3/2002 and picked_up_date<=6/3/2003)

and

is_picked_up=\'Y\'

order by

ticket_id

 

I am trying to get al the records between 1/3/2002 and 6/3/2003. But this query is giving me nothing and if I change the \'and\' to \'or\' then it gives me all the records..

 

any help !!!!!

Link to comment
Share on other sites

I worked, I put the date in quotes and used the date format function to change the database date

 

Select

item_id,

customer_name

from

jb_inventory

where

(DATE_FORMAT(picked_up_date,\'%c/%e/%Y\') >=\'1/9/2002\'

and

DATE_FORMAT(picked_up_date,\'%c/%e/%Y\') <=\'6/4/2003\')

and

is_picked_up=\'Y\'

order by

ticket_id

 

Thanks effigy

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.