简体   繁体   中英

MySQL - cant get the right order_by and group_by in query

I have this query:

select comment_id , section_name , comment , solution_part , display_order from 
solution_sections 
left join suggested_solution_comments on 
solution_sections.solution_section_id = suggested_solution_comments.solution_part and problem_id = 400
order by display_order; 

What I wanted back was the all items (even null) returned ordered by the display_order column and if some have the same display_order, then those should be ordered by comment_id

Is there any way to do that?

Thanks!

除非我错过了一些东西,否则order by display_order, comment_id应该给你想要的东西

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM