<query id="getDocumentExtraVarsCount" action="select">
	<tables>
		<table query="true" alias="A">
			<tables>
				<table name="documents" />
				<table name="document_extra_vars" alias="extra_vars" />
			</tables>
			<columns>
				<column name="count(*)" alias="count" />
			</columns>
			<conditions>
				<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
				<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
				<condition operation="equal" column="extra_vars.module_srl" default="documents.module_srl" pipe="and" />
				<condition operation="equal" column="extra_vars.document_srl" default="documents.document_srl" pipe="and" />
				<condition operation="equal" column="extra_vars.var_idx" var="var_idx" pipe="and" />
				<condition operation="equal" column="extra_vars.eid" var="var_eid" pipe="and" />
				<condition operation="in" column="documents.status" var="statusList" pipe="and" />
				<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
			</conditions>
			<groups>
				<group column="extra_vars.document_srl" />
			</groups>
		</table>
	</tables>
	<columns>
		<column name="count(A.count)" alias="count" />
	</columns>
</query>
