php - MySQL: order by sum
845
I have article table
`id`,
`article_id`,
`stage_1_point`,
`stage_2_point`
I need top 10 articles based on
(stage_1_point+stage_2_point),
in the list and when i view any article i need to show its place. My question is how can show its place without using order by.
Answer
Solution:
USE
ORDER BY (stage_1_point+stage_2_point) DESC
So, It will be like
UPDATE
As OP stated, he/she needs to know the position of specific article.
Above query will return rows for article_id 10, which will have a column
Rank
which tells the position of the article.Answer
Solution:
You can try below Query as below
This will sort data based on column one result and fetch top 10 results only.