SQL syntax question

This SQL statement returns the same result twice even though there is
only one matching entry in the first table "tbl_Drivers" and none in
the second table. Can anyone explain why? I would appreciate it very
much. I am trying to improve my understanding of SQL.

SELECT * FROM tbl_Drivers Drvs, tbl_Del_Drivers DelDrvs where
(Drvs.FName = 'Larry' AND Drvs.LName = 'Smith') OR (DelDrvs.FName =
'Larry' AND DelDrvs.LName = 'Smith');
Tenacious [ Do, 19 Oktober 2006 01:54 ] [ ID #1506232 ]

Re: SQL syntax question

Tenacious wrote:
> This SQL statement returns the same result twice even though there is
> only one matching entry in the first table "tbl_Drivers" and none in
> the second table. Can anyone explain why? I would appreciate it very
> much. I am trying to improve my understanding of SQL.
>
> SELECT * FROM tbl_Drivers Drvs, tbl_Del_Drivers DelDrvs where
> (Drvs.FName = 'Larry' AND Drvs.LName = 'Smith') OR (DelDrvs.FName =
> 'Larry' AND DelDrvs.LName = 'Smith');

Since you have given no conditions relating the two table, it's a "cross
join". See http://en.wikipedia.org/wiki/Cross_join#Cross_join

Regards,
Bill K.
Bill Karwin [ Do, 19 Oktober 2006 02:53 ] [ ID #1506233 ]
Datenbanken » mailing.database.mysql » SQL syntax question

Vorheriges Thema: Syncronizing updates from file to mysql
Nächstes Thema: [ANN] VTD-XML 1.7