List:General Discussion« Previous MessageNext Message »
From:Jules Bean Date:April 26 1999 1:57pm
Subject:Re: Problem executing query, a bug perhaps?
View as plain text  
"A. Brandic" wrote:
> 
> Sorry Jules!
> 
> You were right, it is displaying 'MN' number of rows.  I did not think it
> would have but it does.  I've just created a small table with 5 records
> in it and used it in the above query instead of Streams table and it
> displaye over 60000 recods instead of 15000.  My view was that the extra
> table (rows from the extra table) would have been ignored after the
> execution of the query.

Well, I regret to say it... but in that case, you don't understand SQL
syntax.

Suppose A, B are joined by a unique field ID in each of them.

SELECT * FROM A,B;

Will return a cartesian product - one row for each possible pairing of
rows, one from A and one from B.

SELECT * FROM A,B WHERE A.ID = B.ID;

Will only return those pairings where the two columns in the cartesian
product 'A.ID' and 'B.ID' have identical values.  This is, in general, a
much more useful query :-)

If you think about it for a while, you'll see why this is the only sane
way to interpret the queries.

Jules


-- 
/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules@stripped         |  6 Evelyn Rd        |
|  Jules aka     |                               |  Richmond, Surrey   |
|  Julian Bean   | jmlb2@stripped        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/
Thread
Question: how to count unique rows in multiple tables?Kelly Yancey22 Apr
Re: Question: how to count unique rows in multiple tables?Tomislav Petrovic23 Apr
  • Problem executing query, a bug perhaps?A. Brandic26 Apr
    • Re: Problem executing query, a bug perhaps?Jules Bean26 Apr
      • Re: Problem executing query, a bug perhaps?A. Brandic26 Apr
      • Re: Problem executing query, a bug perhaps?A. Brandic26 Apr
        • Re: Problem executing query, a bug perhaps?Jules Bean26 Apr
    • Re: Problem executing query, a bug perhaps?Sasha Pachev26 Apr