任何人都可以帮助我进行查询,该查询从我的家表中选择一个家,并将另一个表中的值列表获取到单个列中。该查询来自我在此处发布的另一个问题的帮助,但是我现在正尝试根据需要添加到查询中。当我尝试在另一个表中添加一个列时,Oracle 会抛出一个无效标识符错误,下面是我的查询;
SELECT homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft,
listagg(features.feature_name, ',') WITHIN GROUP (ORDER BY features.feature_name) features, home_type.type_name, home_photo.photo, home_photo.description
FROM homes, home_type, home_photo
INNER JOIN home_feature
ON homes.home_id = home_feature.home_id
INNER JOIN features
ON home_feature.feature_id = features.feature_id
INNER JOIN home_photo
ON home_photo.home_id = homes.home_id
WHERE home_type.type_code = homes.type_code AND homes.homes_id = home_photo.home_id
GROUP BY homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft, home_type.type_name;
上面的查询抛出了这个,但该列确实是正确的:
ORA-00904: "HOMES"."HOME_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 5 Column: 4
从我的其他问题中删除原始查询的列会导致查询工作吗?以下是添加来自不同表的其他列之前的工作查询:
SELECT homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft,
listagg(features.feature_name, ',') WITHIN GROUP (ORDER BY features.feature_name) features
FROM homes
INNER JOIN home_feature
ON homes.home_id = home_feature.home_id
INNER JOIN features
ON home_feature.feature_id = features.feature_id
GROUP BY homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft;
如果有人可以提供帮助,谢谢。