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 27790 게시물 읽기
No. 27790
오라클 쿼리를 MS-SQL로 변환 하려고 하는데요
작성자
오렌지
작성일
2008-09-17 14:15
조회수
3,991

select tbl.noticeno, tbl.subject, tbl.contents, tbl.writedate

from   (select

a.noticeno, a.subject, a.contents,

substring(a.writedate,1,4)+'-'+substring(a.writedate,5,2)+'-'+substring(a.writedate,7,2) writedate

from   TC_NOTICE a where  1=1

and    a.NOTICETYPE IN('1','2','3','4','5','6')

ORDER BY writedate DESC

) tbl

where  rownum <= 3


이게 오라클 쿼리고여


select tbl.noticeno, tbl.subject, tbl.contents, tbl.writedate

from   (select

a.noticeno, a.subject, a.contents,

substring(a.writedate,1,4)+'-'+substring(a.writedate,5,2)+'-'+substring(a.writedate,7,2) writedate

from   TC_NOTICE a where  1=1

and    a.NOTICETYPE IN('1','2','3','4','5','6')

//ORDER BY writedate DESC

) tbl

//where  rownum <= 3


주석 막고 하면 실행은 되는데

주석 처리 한거까지 적용 시켜서 하려면 어떻게 변환 해야 하나요???

이 글에 대한 댓글이 총 1건 있습니다.

select

a.noticeno, a.subject, a.contents,

 

substring(a.writedate,1,4)+'-'+substring(a.writedate,5,2)+'-'+substring(a.writedate,7,2) writedate

 

from   TC_NOTICE a where  1=1

 

and    a.NOTICETYPE IN('1','2','3','4','5','6')


order by writedate DESC


limit 3



로 간단히 되구요. 원래 오라클 쿼리도 굳이 from 절에 select문을 넣지 않고 위와 비슷한 형태로 simple하게 만들 수 있습니다.

우욱님이 2008-09-18 14:30에 작성한 댓글입니다. Edit
[Top]
No.
제목
작성자
작성일
조회
27793초보 쿼리 질문드려요
신철화
2008-09-17
3946
27792Lost connection to MySQL server at 'reading initial communication packet', system error: 104
김강호
2008-09-17
5130
27791[질문]배치파일에서 인자를 넘겨주는 방법 [1]
최동만
2008-09-17
4494
27790오라클 쿼리를 MS-SQL로 변환 하려고 하는데요 [1]
오렌지
2008-09-17
3991
27789VBScript를 이용하여 MySQL 을 인서트할 수 있나요?
고영석
2008-09-17
3547
27788outer join시 애매한 것... [1]
머털이
2008-09-17
3856
27787조인문 질문하나 드립니다. [1]
쪼아
2008-09-17
3744
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.018초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다