When I try to do the select statement, I always get the following error:
ERROR: more than one row returned by a subquery used as an expression
Only if there’s only one result, it works. Why and how to fix?
SELECT name from person p where
id = ( select prs from leader
where age(leader.lastcourse) > '1 year');
You are trying to assign one particular ID from a select that seems to be returning multiple ID’s. OrbMan’s solution will take the first ID, randomly, from the subquery. If you want ALL ID’s that meet the subquery condition,
Mark’s approach to use a JOIN rather than subquery also works.