Search problem

Started by Oscaralmost 26 years ago3 messagesgeneral
Jump to latest
#1Oscar
oscar@sjs.com

Hi,

I am using apache/php and postgres and I tried a search with dates, but it
doesn't accept it...

select * from table where date_field < 10-10-2000;

It yells that I cannot use < signs with ints and dates...

Any suggestions ??

Thanks,
Oscar

#2Julie Hunt
jhunt@chac.qld.edu.au
In reply to: Oscar (#1)
Re: Search problem

Try:-

select * from table where date_field < '10-10-2000'::datetime; (or date if
your date_field is of type date)

Regards
Julie Hunt

Oscar wrote:

Show quoted text

Hi,

I am using apache/php and postgres and I tried a search with dates, but it
doesn't accept it...

select * from table where date_field < 10-10-2000;

It yells that I cannot use < signs with ints and dates...

Any suggestions ??

Thanks,
Oscar

#3James R. R. Service
jservice@yahoo.com
In reply to: Oscar (#1)
Re: Search problem

Oscar wrote:

I am using apache/php and postgres and I tried a search with dates, but it
doesn't accept it...

select * from table where date_field < 10-10-2000;

It yells that I cannot use < signs with ints and dates...

Any suggestions ??

Use quotes for *anything* other than numbers. A date is not a number so
try:

select * from table where date_field < '10-10-2000' ;

However, depending on how dates are formatted it might be better written
as

select * from table where date_field < '2000-10-10' ;

--Jim