경로
/modules/board/skins/jslocal_timeline/queries/getExtra.xml
코드
<query id="getSubjectExtra" action="select"> <tables> <table name="documents" alias="document" /> <table name="document_extra_vars" alias="extra" type="left join"> <conditions> <condition operation="equal" column="document.document_srl" default="extra.document_srl" /> <condition operation="equal" column="document.module_srl" var="module_srl" pipe="and"/> <condition operation="equal" column="extra.eid" default="enddate" pipe="and" /> </conditions> </table> <table name="document_extra_vars" alias="extra2" type="left join"> <conditions> <condition operation="equal" column="document.document_srl" default="extra2.document_srl" /> <condition operation="equal" column="document.module_srl" var="module_srl" pipe="and"/> <condition operation="equal" column="extra2.eid" default="manager" pipe="and" /> </conditions> </table> </tables> <columns> <column name="document.document_srl" /> <column name="document.title" /> <column name="extra.value" alias="enddate" /> <column name="extra2.value" alias="manager" /> <column name="extra.module_srl" /> </columns> <conditions> <condition operation="equal" column="document.module_srl" var="module_srl" filter="number" notnull="notnull" /> </conditions> <navigation> <index var="sort_index" default="enddate" order="desc" /> <list_count var="list_count" default="20" /> <page_count var="page_count" default="10" /> <page var="page" default="1" /> </navigation> </query>
설명
getSubjectExtra 라는 커스텀 쿼리문입니다.
documents 테이블에 document_extra_vars 테이블 중 eid값이 enddate인 컬럼과, eid값이 manager인 컬럼의 value값을 각각 left join 방식으로 결합해서 사용했습니다.