no | id
| price | sell_date
| check |
00081900000000000001 0000006
3000 2001-10-14 오후 2:09:02 Y
00081900000000000002 0000006
3000 2001-10-15 오후 2:09:02 N
00081900000000000003 0000004
1000 2001-10-16 오후 2:09:02 Y
00081900000000000004 0000006
3000 2001-10-17 오후 2:09:02 N
00081900000000000005 0000004
500 2001-10-19 오후 2:09:02 Y
아이디 별, 판매월별로 check가 Y(수금된)인
금액의 합산을 얻어낼려고 합니다...
select no, id, price
from 테이블명 where convert(varchar(50),sell_date, 121) like
'2001-10%'
and check <> 'Y'
order by id
compute sum(price) by id
이렇게 했는데 잘못된것 같은데... 어디가 잘못된지
모르겠습니다.
|