basic SQL request

Started by Alain Rogerover 19 years ago4 messagesgeneral
Jump to latest
#1Alain Roger
raf.news@gmail.com

Hi,

i've tried to run a basic SQL request as followed :
select *
from articles, articletypes, department
where
articles.articletype_id = articletype.articletype_id AND
articles.department_id = department.department_id AND
articles.validity_period_end > now()

and i got the following error message :
ERROR: missing FROM-clause entry for table "articletype"

i'm confused now, if i use LEFTJOIN it's the same, so where is the trouble ?

thx,

AL.

#2Marco Bizzarri
marco.bizzarri@gmail.com
In reply to: Alain Roger (#1)
Re: basic SQL request

You wrote articletype instead of articletypes in the first WHERE
clause: is this the problem?

Regards
Marco

--
Marco Bizzarri
http://iliveinpisa.blogspot.com/

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Alain Roger (#1)
Re: basic SQL request

On Sunday 05 November 2006 11:42 am, Alain Roger wrote:

Hi,

i've tried to run a basic SQL request as followed :
select *
from articles, articletypes, department

^ s

where
articles.articletype_id = articletype.articletype_id AND

^ no s

articles.department_id = department.department_id AND
articles.validity_period_end > now()

and i got the following error message :
ERROR: missing FROM-clause entry for table "articletype"

i'm confused now, if i use LEFTJOIN it's the same, so where is the trouble
?

thx,

AL.

The table name in the FROM clause has an s on the end. The name in the WHERE
clause does not.

--
Adrian Klaver
aklaver@comcast.net

#4Shoaib Mir
shoaibmir@gmail.com
In reply to: Alain Roger (#1)
Re: basic SQL request

Check this out:

"= articletype.articletype_id AND"

and in your from clause you have something like this:

"from articles, articletypes, department"

So you need to fix "articletypes" or if it is "articletype"

Regards,
-------
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

Show quoted text

On 11/6/06, Alain Roger <raf.news@gmail.com> wrote:

Hi,

i've tried to run a basic SQL request as followed :
select *
from articles, articletypes, department
where
articles.articletype_id = articletype.articletype_id AND
articles.department_id = department.department_id AND
articles.validity_period_end > now()

and i got the following error message :
ERROR: missing FROM-clause entry for table "articletype"

i'm confused now, if i use LEFTJOIN it's the same, so where is the trouble
?

thx,

AL.