Order by subquery MySQL

vuv7lop3  于 2022-12-22  发布在  Mysql
关注(0)|答案(1)|浏览(153)

Hello I want to display the name of the activities according to the order of their addition in the feed (FeedId=incremented id) and with a preselected team number however the order in the subquery is not respected.
MariaDB [database]

select name from activity where id=(select ActivityId from feed where TeamId=16 order by FeedId);

I tried to take out the order by but without success. Someone would have any idea ?

u3r8eeie

u3r8eeie1#

Try using inner join, something like this

select name 
from activity 
inner join feed on feed.ActivityId = activity.id
where TeamId=16 
order by FeedId;

相关问题