이유는 모르지만 코드가 작동하지 않는 것 같습니다. 그 중 하나는 오류 1052 또는 1054가 나타납니다. 여기에 내 코드가 있습니다. 도와주세요.MySQL 오류 1054 : 알 수없는 열 'on clause'의 'hotels.postal_code'
SELECT
hotels.postal_code AS ' Hotel Postal Code',
name AS 'Hotel Name',
latitude AS 'Latitude',
longitude AS 'Longitude',
address AS 'Hotel Address',
hyperlink AS 'Hotel Hyperlink',
hotels.district AS 'Hotel District',
'hotel' AS type
FROM
hotels
join
hotel_sales ON hotels.postal_code = hotel_sales.sales_id
join
postal_code_location ON hotels.district = postal_code_location.district
UNION SELECT
malls.postal_code AS ' Mall Postal Code',
name AS 'Mall Name',
latitude AS 'Latitude',
longitude AS 'Longitude',
address AS 'Mall Address',
hyperlink AS 'Mall Hyperlink',
malls.district AS 'Mall District',
'mall' AS type
FROM
malls
join
hotel_sales ON hotels.postal_code = hotel_sales.sales_id
join
postal_code_location ON hotels.district = postal_code_location.district
과 같이해야한다
쿼리에 대한
'ON hotels.postal_code = hotel_sales.sales_id '가 잘못되었습니다. 'ON hotels.hotel_id = hotel_sales.hotel_id' 인 것처럼 나에게 들리는가요? –
두 번째 선택에서는'hotels.postal_code'에 참여하고 있지만'hotels'은 해당 쿼리에 사용되지 않습니다. 당신은'몰'중에서 선택합니다. –