database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 2552 게시물 읽기
No. 2552
# Re: Re: # 꼭 알고 싶어서요...(sql)
작성자
김하정
작성일
2000-07-11 15:34
조회수
2,471

select count(*) as cnt

from igt_document a,igt_docfolder b,igt_log c

where a.doc_yearmon=b.doc_yearmon and b.userlog_id=c.userlog_id

and a.doc_number=b.doc_number

and (c.userlog_type='3' or (c.userlog_type='6' and a.fax_page=1))

and b.folder_date> (sysdate-7)

and c.userlog_id not in ('유우머','01011','010112','0101113')

and a.doc_type='4';

 

 

 

select count(*) as cnt

from igt_document a,igt_docfolder b,

(select userlog_type,userlog_id

from gt_log where not in ('유우머','01011','010112','0101113')) c

where a.doc_yearmon=b.doc_yearmon and b.userlog_id=c.userlog_id

and a.doc_number=b.doc_number

and (c.userlog_type='3' or (c.userlog_type='6' and a.fax_page=1))

and b.folder_date> (sysdate-7)

and a.doc_type='4';

이렇게 바꾸면..아마.빠를것 같는데용~~~^^

subquery로 바꾸시면..아마 빠를것 같군요..

그리고 sysdate-7같는 경우는 index를 이용하려면..

미리 변수를 지정하새..

v_date=sysdate-7;로..

지정한다음.

and b.folder_date> v_date

이렇게 하는것도 좋은 방법입니다..

도움이 되시기를.

[Top]
No.
제목
작성자
작성일
조회
2542[질문]에러없이 디비에 저장이 안됩니다...이 답답함을...
밥튕
2000-07-11
1904
2545┕>Re: [질문]에러없이 디비에 저장이 안됩니다...이 답답함을...
정재익
2000-07-11 14:18:11
1926
2546 ┕>Re: Re: [질문]에러없이 디비에 저장이 안됩니다...이 답답함을...
밥튕
2000-07-11 14:39:43
1901
2541MySQL에 Index를 어떻게 걸어주어야 할까요?
정태호
2000-07-11
1899
2547┕>Re: MySQL에 Index를 어떻게 걸어주어야 할까요?
정재익
2000-07-11 14:40:14
2520
2540[초보의질문] 패스워드 바꿀때... DB패스워드하고 계정패스워드는 다른건가요??
huhch
2000-07-11
1750
2548┕>Re: [초보의질문] 패스워드 바꿀때... DB패스워드하고 계정패스워드는 다른건가요??
정재익
2000-07-11 14:42:44
2146
2538# 꼭 알고 싶어서요...(sql)
김은정
2000-07-11
1991
2549┕>Re: # 꼭 알고 싶어서요...(sql)
정재익
2000-07-11 14:46:53
2125
2552 ┕># Re: Re: # 꼭 알고 싶어서요...(sql)
김하정
2000-07-11 15:34:26
2471
2537또굉장히급한 질문
APM초보
2000-07-11
1853
2539┕>Re: 또굉장히급한 질문
배움이
2000-07-11 10:42:48
2080
2536GCC (C++ compiler cannot create executables)
sean
2000-07-11
2314
2550┕>Re: GCC (C++ compiler cannot create executables)
정재익
2000-07-11 14:49:09
2286
2533한개의 테이블에서의 컬럼수와 효율.
배움이
2000-07-11
2015
2534┕>Re: 한개의 테이블에서의 컬럼수와 효율.
정재익
2000-07-11 09:44:50
2462
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.019초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다