Re: syntax error on WHERE clause...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Poor <rdpoor(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: syntax error on WHERE clause...
Date: 2011-03-16 00:15:31
Message-ID: 9127.1300234531@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Robert Poor <rdpoor(at)gmail(dot)com> writes:
> 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?

INNER JOIN requires an ON clause. If you really don't need any
additional join conditions than what's in the WHERE, you could write
CROSS JOIN, or you could just put commas there.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message siva kiran balijepalli 2011-03-16 06:47:52 diference between calling a function in select clause and from clause
Previous Message Robert Poor 2011-03-15 23:44:18 syntax error on WHERE clause...