MySQL Forums
Forum List  »  Newbie

Re: Problem with advance query
Posted by: Chris Preston
Date: March 18, 2009 04:37PM

select date_field, file_number from your_table where date_field<=curdate();

before you do that you should do:

create idx1_your_table_name_1 on your_table_name(date_field, file_number);

The index will speed up your query significantly.



Andrew Tan Wrote:
> I need to solve this problem, I have a table with
> a whole bunch of information.
> One field is called File Number the other is
> called Date.
> Basically I want to run a query to search for all
> the file number that dont have a date greater than
> or equal to current date.
> Been thinking at it but got no clue.
> Currently this is what I got select * File_Number,
> BF_Date from "DBname"
> Somehow I need to filter that to only list the
> File Number that dont have a date greater or equal
> to today.

Options: ReplyQuote

Written By
March 18, 2009 01:45PM
Re: Problem with advance query
March 18, 2009 04:37PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.