Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Order by subquery MySQL

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 ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading