a 라는 table에
code,
name,
type,
region
등의 필드가 있습니다
그리고 b 라는 table에
code
type
update_date,
low_price
high_price
가 있고
c 라는 table에
code
type
update_month
update_year
low_price
high_price
average_price
등 이 있습니다.
code, name, type, low_price, high_price, average_price를 가져오려고 하는데
code와 name은 주어진 region에 의해 가져옵니다.
이럴때 가장 최근의 정보를 가져오고 싶은데 어떻게 해야 할까요?
code에 따른 type이 여러가지가 있고
type에 따른 low_price와 high_price, average_price도 여러개의 데이타가
있습니다.
아궁 복잡하네요
제가
select A.code, A.name, A.type, B.low_price, B.high_price, B.average_price
from a as A, c as B where A.code = B.code and A.region="주어진값"
이라고 하니까 최근 업데이트 된 데이터만 나오는게 아니라 전체가 다나오는데
어떻게 해야 할지 모르겠습니다.
쿼리문을 하나만 써서 해볼 수 있는 방법이 없을까요?
and B.update_year="올해" and B.update_month="이달"
이부분을 추가하니까 업데이트 날짜가 이전인 것들을 가져오지 못하네요.
아 고민 고민....
해결좀 해주세요..