私の家のテーブルから家を選択し、別のテーブルから値のリストを単一の列に取得するクエリを手伝ってくれる人はいますか。クエリは、私がここに投稿した別の質問の助けを借りて作成されましたが、必要に応じてクエリに追加しようとしています。列フォームに別のテーブルを追加しようとすると、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;
誰かが助けてくれたらありがとう。