mysql 정렬관련 질문드립니다. 1, 14, 1_17, 2, 3, 4 정보
mysql 정렬관련 질문드립니다. 1, 14, 1_17, 2, 3, 4본문
카테고리를 만들어놨습니다.
값을 바꾸긴 어려운 상태이고 데이터가 들어가 있는 내용은
category_id(카테고리아이디) wr_name 명칭
1 학교
1_1 축구
1_2 농구
1_3 야구
2 학원
2_1 학습지
2_2 문제지
16 슈퍼
16_1 과자
뭐 이런식으로 있다고 데이터가 있다고 쳤을때 위와 같은 형태로 데이터가 정렬되면 참 좋을텐데..
select * from 테이블명 order by category_id desc
이렇게 하면
1
16
1_2
1_3
뭐 이렇게 정렬이 됩니다. 해결방법이 없을까용?
값을 바꾸긴 어려운 상태이고 데이터가 들어가 있는 내용은
category_id(카테고리아이디) wr_name 명칭
1 학교
1_1 축구
1_2 농구
1_3 야구
2 학원
2_1 학습지
2_2 문제지
16 슈퍼
16_1 과자
뭐 이런식으로 있다고 데이터가 있다고 쳤을때 위와 같은 형태로 데이터가 정렬되면 참 좋을텐데..
select * from 테이블명 order by category_id desc
이렇게 하면
1
16
1_2
1_3
뭐 이렇게 정렬이 됩니다. 해결방법이 없을까용?
( select a.* , ( select sum(co_count) as co_count from g4_qa_choose where mb_id=a.mb_id and bo_table = 'g4_qa' ) as q_co_count from `g4_write_g4_qa` a where wr_parent = '263983' and wr_8 != '' and wr_is_comment = 1 and CONVERT(wr_7, UNSIGNED) >= 5 group by wr_content having max(wr_7) order by CONVERT(wr_7, UNSIGNED) desc limit 3 )
1055 : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sir.a.wr_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
error file : /15sir/bbs/board.php