샘플
crate table test(
idx int not null,
subject varchar(250) not null,
description varchar(2000) not null,
keyword varchar(100) not null
)
위와 같은 테이블을 전문 필드로
subject, description, keyword를 설정하고 색인 완료 했습니다.
* 개별 필드 조회
select * from test contains(subject, '"test"');
select * from test contains(description, '"test"');
select * from test contains(keyword, '"test"');
* 위와 같이 방식의 조회를 사용하지 않고.. 랭킹을 적용하기
위하여.. 아래와 같이 검색을 하고 있습니다.
SELECT TOP 10 A.idx, A.subject, A.description, A.keyword,
B.rank
FROM test A,
CONTAINSTABLE(test, subject, '"test"') B
WHERE A.idx=B.[KEY] AND
ORDER BY RANK DESC
위와 같은 방식으로 조회 하고 있습니다..
SELECT TOP 10 A.idx, A.subject, A.description, A.keyword,
B.rank
FROM test A,
CONTAINSTABLE(test, subject, '"test"') B
CONTAINSTABLE(test, keyword, '"keyword"') C
WHERE A.idx=B.[KEY] AND A.idx=C.[KEY]
ORDER BY B.RANK DESC
이런식으로 조회하는 방법 외에.. 동시에 두개의 컬럼을 조회할수
있는지. 알고 싶습니다..
|