Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- error
- Config
- ViewModel
- dbContext
- ORM
- .net
- 에스가든스냅
- 스냅잘찍음
- 상속
- mac
- Request
- c#
- 라도무스dvd
- vscode
- c#코딩의기술실전편
- extjs
- LINQ
- intellij
- JSON
- JavaScript
- 대전본식영상
- 코드프로그래머스
- lazy loading
- Store
- minimalAPI
- EFCore
- React
- 명시적외래키
- extraParams
- scanner
Archives
- Today
- Total
ejyoo's 개발 노트
ibatis where 절에 조건 추가하기 본문
<select id="getSearchMenu" parameterClass="kr.or.ddit.menu.vo.MenuVO" resultClass="kr.or.ddit.menu.vo.MenuVO">
SELECT A.REST_NAME restName
,A.REST_FAV_CNT restFavCnt
,A.REST_CEO_NAME restCeoName
,A.REST_ADD1 restAdd1
,A.REST_ADD2 restAdd2
,A.REST_REVIEW_CNT restReviewCnt
,A.REST_DISTANCE restDistance
,A.REST_TYPE restType
,A.REST_CODE restCode
,B.MENU_NAME menuName
,B.MENU_PRICE menuPrice
FROM TB_REST_INFO A INNER JOIN TB_MENU B ON(A.REST_CODE = B.REST_CODE)
WHERE 1=1
<isNotEmpty property= "restDistance" prepend="AND">
A.REST_DISTANCE = #restDistance#
</isNotEmpty>
<isNotEmpty property="restType" prepend="AND">
A.REST_TYPE = #restType#
</isNotEmpty>
<isNotEmpty property="menuPrice">
<isEqual prepend="AND" property="menuPrice" compareValue="10000">
B.MENU_PRICE >= #menuPrice#
</isEqual>
<isEqual prepend="AND" property="menuPrice" compareValue="9000">
<![CDATA[#menuPrice# <= B.MENU_PRICE AND B.MENU_PRICE <= #menuPrice#+999 ]]>
</isEqual>
<isEqual prepend="AND" property="menuPrice" compareValue="8000">
<![CDATA[#menuPrice# <= B.MENU_PRICE AND B.MENU_PRICE <= #menuPrice#+999 ]]>
</isEqual>
<isEqual prepend="AND" property="menuPrice" compareValue="7000">
<![CDATA[#menuPrice# <= B.MENU_PRICE AND B.MENU_PRICE <= #menuPrice#+999 ]]>
</isEqual>
<isEqual prepend="AND" property="menuPrice" compareValue="6000">
<![CDATA[#menuPrice# <= B.MENU_PRICE AND B.MENU_PRICE <= #menuPrice#+999 ]]>
</isEqual>
<isEqual prepend="AND" property="menuPrice" compareValue="5000">
<![CDATA[#menuPrice# <= B.MENU_PRICE AND B.MENU_PRICE <= #menuPrice#+999 ]]>
</isEqual>
</isNotEmpty>
</select>
'DB > Oracle' 카테고리의 다른 글
Update 다른 테이블에 있는 데이터까지 한꺼번에 업데이트 (0) | 2021.04.29 |
---|---|
where 절에 식당 가격 비교 코드 , 이름 기준 검색 코드 (0) | 2021.04.27 |
쿼리에서 Where 절에 IF문 사용하는 방법 (0) | 2021.04.26 |
insert 문 여러개 입력(테이블이 같은경우, 테이블이 다른경우) (0) | 2021.04.25 |
ERMaster 설치 (0) | 2021.04.15 |