> Can anyone explain why this SQL statement would fail? A friend was asked it
> in a pre-interview assessment and it threw him a bit.
> 
> SELECT T1.BldgName T1.StreetName, T1.Locality, T1.PostTown from PstlAddr T1
> Where T1.City='London' AND NOT EXISTS (SELECT T2.Pstl_Address_PK from
> PrsnAddress T2)

Assuming there is no typo, the missing comma after T1.BldgName means
the T1 from T1.StreetName will be used as an alias.  Then there's a
".StreetName" left, which is invalid syntax.

Assuming there is a typo, and there's supposed to be a comma after
T1.BldgName, then there is no syntax error, provided you are using
version 4.1 or later.  The query might not do what you expect
(depending on what you expect) because there is nothing to relate T1
to T2.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to