Table A contains columns photo and id
Table B contains columns id, other_id and rank (primary index on id and other_id)
The following query correctly returns the result I want, except that it ignores my request to order by rank, and I need it to do that.
SELECT photo FROM A WHERE id= ANY(SELECT id FROM B WHERE other_id='$other_id')
Any suggestions?
ORDER BY in subquery not working
Moderator: General Moderators
Re: ORDER BY in subquery not working
join the tables 
Code: Select all
SELECT photo FROM A INNER JOIN B USING (id) WHERE other_id='$other_id' ORDER BY rankRe: ORDER BY in subquery not working
Yes, I had suspected an inner join was the key, but those I wrote didn't work. Yours worked perfectly! Thanks!