Can anyone help me with my query which selects a homes from my homes table and also gets a listagg of values form another table into a single column. The query came with the help from another question i posted on here, however i am now trying to add to the query as needed. When i try to add in a column form another table Oracle throws back an invalid identifier error below is my query;
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;
The above query throws this, but the column is indeed correct:
ORA-00904: "HOMES"."HOME_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 5 Column: 4
removing the columns to the original query from my other question result in the query working? Below is the working query before the addition of the other columns from different tables:
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;
Thank you if anyone can help.
will work. ie don’t mix up ANSI + oracle join syntax.