开发者

mysql 'order by' problem? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

Closed 4 years ago.

Improve this question

each one of them has the option to be stick at the first of the category , now the field name of the stick is n_stick it's 1/0 value , and also each new post has a time , now i need to order the news according to which is it stick new or not, and second to it's time , which mean that all the sticky news show at first ordered by the newest time and after them the non-sticky news also ordered by the new开发者_JS百科est time , ALL of this in same Query , this is the problem .

I tried this but did not work :

SELECT * FROM news ORDER BY n_stick,n_time DESC

Also did tried this :

SELECT * FROM news ORDER BY n_stick DESC,n_time DESC

But also no solution , any help buddy's ?

thank you .


Your second query:

SELECT  *
FROM    news
ORDER BY
        n_stick DESC, n_time DESC

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜