You should use single quotes for all literals.
Examples:
select '2004-06-08' ;
?column?
2004-06-08
select 'user' ;
?column?
--
user
Failing to quote literals will cause unexpected results.
Examples:
select 2004-06-08 ;
?column?
--
1990
select user ;
current_user
--
Ha. Why so it is. :)
-tfo
--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005
On Nov 18, 2004, at 11:50 PM, Greg Stark wrote:
"Thomas F.O'Connell" <[EMAIL PROTECTED]> writes:
select 2004
"Thomas F.O'Connell" <[EMAIL PROTECTED]> writes:
> select 2004-06-08;
> ?column?
> --
> 1990
>
> I'm not exactly sure how the bare string is converted internally, but it's
> clearly not a complete date like you're expecting.
What string? That's just integer arithmetic.
--
greg
Thanks, it turns out that the code that was executing the sql was
flawed. Thanks to all that replied!
-Nick
Ian Barwick wrote:
On Thu, 18 Nov 2004 15:01:58 -0600, Nick Peters
<[EMAIL PROTECTED]> wrote:
Hey,
I am trying to compare dates in a sql statement. this is what i have tried:
SELECT * FR
Nick,
You need to quote your date constant value:
'2004-06-08'
select '2004-06-08'::date > 2004-06-08;
?column?
--
t
(1 row)
select 2004-06-08;
?column?
--
1990
I'm not exactly sure how the bare string is converted internally, but
it's clearly not a complete date like you'r
On Thu, 18 Nov 2004 15:01:58 -0600, Nick Peters
<[EMAIL PROTECTED]> wrote:
> Hey,
>
> I am trying to compare dates in a sql statement. this is what i have tried:
>
> SELECT * FROM transactions WHERE shippingdate>2004-06-08 AND
> transtype='Sale';
SELECT * FROM transactions WHERE shippingdate> '2
Hey,
I am trying to compare dates in a sql statement. this is what i have tried:
SELECT * FROM transactions WHERE shippingdate>2004-06-08 AND
transtype='Sale';
but it returns all rows. When i switch the > with a < it returns
nothing. I have even tried with todays date and have got the same
resu
David,
Please post your tabledefs and the full query definition. Aside from
the need for an explicit typecast (i.e. '2000-03-02'::date) and the lack
of clarity on month vs. day (March 2 or February 3?), seeing the whole
picture would help.
-Josh Berkus
__AGLIO DATABASE SOLUTIONS__
Hello -
It seems that using BETWEEN would work well, especially for finding
dates between two other dates.
WHERE date_date BETWEEN '03-02-2001'::date and '03-03-2001'::date
--d
> On Tue, 6 Mar 2001, Markus Fischer wrote:
>
> > Hello,
> >
> > I've a SELECT statement on many joined Tabled and
I think if you cast it then works.
e.g.
'02-03-2001'::date
'02-03-2001'::timestamp
Jie LIANG
St. Bernard Software
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
[EMAIL PROTECTED]
www.stbernard.com
www.ipinc.com
On Tue, 6 Mar 2001, Markus Fischer wrote:
> Hell
I am just wildly guessing here, but you initially stated that you queried
on '02-03-2001' (Which I read as February 3, 2001 -- and I belive postgres
does as well) which returned 60 results, and on '03-03-2001' (March 3,
2001), which returned 70 results. However, that is *not* the query your
wrote
On 3/6/01, 4:38:41 PM, <[EMAIL PROTECTED]> wrote regarding Re: [SQL]
Comparing dates:
> Markus Fischer wrote:
> > I've a SELECT statement on many joined Tabled and one of them has
> > a date column called 'date_date'. When I fetch a date e.g.
> > '
Markus Fischer wrote:
> Hello,
>
> I've a SELECT statement on many joined Tabled and one of them has
> a date column called 'date_date'. When I fetch a date e.g.
> '02-03-2001', I get, say, 60 results back. When I now perform the
> same query with another date, lets take '03-03-2001', I get back
Hello,
I've a SELECT statement on many joined Tabled and one of them has
a date column called 'date_date'. When I fetch a date e.g.
'02-03-2001', I get, say, 60 results back. When I now perform the
same query with another date, lets take '03-03-2001', I get back
about 70 results.
When I now modi
14 matches
Mail list logo