table desk (
o_code char; //primary key
a_code char;
)
와 table chair (
s_code char; //primay key
o_code char;
s_price money;
)
가 있을 때 desk에서 a_code='A00001' 값을 가지는 o_code 들과
chair 에서 o_code=desk.o_code인 s_price의 합을 추출하려고 합니다.
그래서 아래와 같이 sql을 작성했는데 에러가 나네요.
select o_code, s_price
from desk, chair
where a_code = 'A00001' and desk.o_code = chair.o_code;
다음은 에러 메시지입니다.
ERROR: parser: illegal use of aggregates or non-group column in target list
도와 주세요.
db는 postgres입니다.
감사합니다.