From: | Robert Poor <rdpoor(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | syntax error on WHERE clause... |
Date: | 2011-03-15 23:44:18 |
Message-ID: | AANLkTinwUCkG5O64=V5xUj1UedCE0_XJeqv1SoXB40ST@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm getting syntax errors in what (I thought) is a simple query. This
query works in SQLite, but in psql 8.3.14 gets:
ERROR: syntax error at or near "WHERE"
Here's the query:
SELECT (d4.digit * 10000 + d3.digit * 1000 + d2.digit * 100 + d1.digit
* 10 + d0.digit) AS date
FROM digits AS d0
INNER JOIN digits AS d1
INNER JOIN digits AS d2
INNER JOIN digits AS d3
INNER JOIN digits AS d4
WHERE (d4.digit * 10000 + d3.digit * 1000 + d2.digit * 100
+ d1.digit * 10 + d0.digit) < 33
ORDER BY date;
Any idea what's wrong?
FWIW, Digits is a table populated with 10 digits:
=> select * from digits;
id | digit
----+-------
1 | 0
2 | 1
3 | 2
4 | 3
5 | 4
6 | 5
7 | 6
8 | 7
9 | 8
10 | 9
(10 rows)
I'm sure it's something obvious, but reading
http://www.postgresql.org/docs/8.3/interactive/queries-table-expressions.html
has yet to lead me to enlightenment.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-03-16 00:15:31 | Re: syntax error on WHERE clause... |
Previous Message | Chetan Suttraway | 2011-03-15 06:05:57 | Re: help regarding function valatality categories |