查询未返回所需的有序结果

时间:2014-03-17 08:51:47

标签: mysql sql

查询句子

select NC.Notice_comment_id, 
       N.Notice_subject, 
       NC.Notice_comment_writer_nickname,
       NC.Notice_comment_content, 
       NC.Notice_comment_register_date, 
       NC.admin_read_check,
       NC.Member_id, 
       NC.Notice_num
  from notice_comment NC 
       inner join notice N
           on NC.Notice_num = N.Notice_num;
 where NC.admin_read_check = 'F';
 order by NC.Notice_comment_id desc;

示例结果

Notice_comment_id    Notice_subject        Notice_comment_writer_nickname
              1      'hello'               'hello'
              2      'hello'               'hello'
              3      'hello'               'hello'
              4      'hello'               'hello'
              5      'hello'               'hello'
              6      'hello'               'hello'
              7      'hello'               'hello'

你为什么要这样做?

1 个答案:

答案 0 :(得分:0)

删除所有;

像那样

SELECT NC.Notice_comment_id, N.Notice_subject, NC.Notice_comment_writer_nickname,
    NC.Notice_comment_content, NC.Notice_comment_register_date, NC.admin_read_check,
   NC.Member_id, NC.Notice_num
 FROM notice_comment NC 
 inner JOIN notice N
 ON NC.Notice_num = N.Notice_num
 WHERE NC.admin_read_check = 'F'
 ORDER BY NC.Notice_comment_id desc