PDA

View Full Version : mysql join hit two tables


crmpicco
08-10-2005, 01:30 PM
select * FROM dbo_tp_airport LEFT JOIN dbo_tp_airportname ON dbo_tp_airport.airportcode=dbo_tp_airportname.airportcode WHERE dbo_tp_airportname.airportcode = ''

i have two tables dbo_tp_airport and dbo_tp_airportname.
dbo_tp_airport has the airportcode KYO,
dbo_tp_airportname doesnt.
I need to find what other airportcodes dont match up.
i.e. what airport codes are in dbo_tp_airport but not dbo_tp_airportname

The above syntax doesnt work.

dbo_tp_airport TABLE STRUCTURE:
+-------------+--------------+----------+
| AirportCode | FacilityCode | CityCode |
+-------------+--------------+----------+
| AAA | A | AAA |
| AAB | A | AAB |
+-------------+--------------+----------+

dbo_tp_airportname TABLE STRUCTURE:
+--------------+-------------+-------------------------------+
| LanguageCode | AirportCode | AirportName |
+--------------+-------------+-------------------------------+
| GB | AAA | Anaa |
| GB | AAB | Arrabury |
+--------------+-------------+-------------------------------+

Thanks.

Picco

Kid Charming
08-10-2005, 04:57 PM
Try:


SELECT
a.AirportCode
FROM
dbo_tp_airport a
LEFT JOIN
dbo_tp_airportname n
ON
a.AirportCode = n.AirportCode
WHERE
n.AirportCode IS NULL