Home > Archive > PostgreSQL Discussion > August 2005 > Re: : Re: A strange problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: : Re: A strange problem
Ragnar Hafstað

2005-08-28, 11:23 am

On Sun, 2005-08-28 at 16:22 +0800, Tang Tim Hei wrote:

> The following commands are little different from the previous one.
> (1) select A.* from test.currency A, test.price_list B where A.curr_cd=B.curr_cd and A.curr_cd='USD'
> (2) select A.* from test.currency A, test.price_list B, test.country C where A.curr_cd=B.curr_cd and A.curr_cd='USD'
>
> For command (1), it is ok. The result is what I expect.
> However, for command (2), it has problem. I added the "test.country C" to it,
> here I actually just write a table name to it and no more other purpose.


I do not understand what you mean by that.
the added table name means an additional cartesian join

> However, the result maybe totally different.


that is because of the added cartesian join

> If the table "country" is not empty, the result is just the same as in command (1)


it will only be the same if the table contains EXACTLY 1 row

> but if "country" is empty, there are no result row.


a cartesian join to 0 rows results in 0 rows

if you are talking about something else, please
show us a concrete simple example.

gnari




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com