arash
05-21-2004, 01:18 AM
hI , this is a self join
SELECT F.PARTNUM, F.DESCRIPTION,
S.PARTNUM, S.DESCRIPTION
FROM F.PART, S.PART
WHERE F.PARTNUM=S.PARTNUM
AND F.DESCRIPTION <> S.DESCRIPTION;
and how the book says F.DESCRIPTION <> S.DESCRIPTION
,if it is self join , so it means everything is the same?????
thanks
Len Boorman
05-21-2004, 03:15 AM
Basically this is written in SQL that uses alias for the Table names.
What it is actually doing I believe is finding Part Numbers that exist with more than one description.
The Select is quite straightforward as is the From
The Where calls for Partnum's that are the same but Descriptions are different.
Basically indicates that if you are having to do this then there is a problem with the table. Suspect Partnum should be a primary key, then it cannot exist more than once and therefore can have only one description.
L
Mile-O
05-21-2004, 03:19 AM
this is a self join
Where's the JOIN keyword then?
Len Boorman
05-21-2004, 03:22 AM
Think that is covered in the Where clause
L
Mile-O
05-21-2004, 03:32 AM
The WHERE clause is just a criteria, a comparison.
A JOIN is used to connect.
Len Boorman
05-21-2004, 03:48 AM
In this case it is actually specifying a criteria Yes and because of the alias qualification it is defining the tables in which these attributes occur.
L