RE: SQL question regarding a couple of table joins. - Mailing list pgsql-sql

From Edmar Wiggers
Subject RE: SQL question regarding a couple of table joins.
Date
Msg-id NEBBIAKDCDHFGJMLHCKIAEPPCAAA.edmar@brasmap.com
Whole thread Raw
In response to SQL question regarding a couple of table joins.  (Warren Vanichuk <pyber@street-light.com>)
List pgsql-sql
> SELECT
>
>  links.linkid,
>
>  links.linkurl,
>  links.linktext,
>  links.bannerid,
>  linkdaystats.linkid
> FROM
>  links,
>  linkdetail ,
>  linkdaystats
> WHERE
>       links.linkid = linkdetail.linkid

I guess you have forgot to include: "links.linkid = linkdaystats.linkid"

Moreover, if table linkdaystats is empty that query will return NOTHING. The
solution is to remove linkdaystats from the query, or wait for 7.1 and use
OUTER JOINs.

Yours sincerely,

Edmar Wiggers
BRASMAP Information Systems
+55 48 9960 2752



pgsql-sql by date:

Previous
From: Warren Vanichuk
Date:
Subject: SQL question regarding a couple of table joins.
Next
From: Tom Lane
Date:
Subject: Re: UNION in views