<jsp:directive.page pageEncoding="UTF-8" />
<og:query command="{@command}" debug="{@debug}" maxRowCount="0" stopZero="true" quotCheck="false" >
	select SYSTEM_ID,TBLSYU,CLM,count(*) as CNT,'' AS UNIQ,'1' AS FGJ
	from  GE82
	where SYSTEM_ID = '{@SYSTEM_ID}'
	and   TBLSYU    = '{@TBLSYU}'
	<og:where startKey="and">
		<og:and value="TABLE_NAME like '{@TABLE_NAME}'" />
		<og:and value="CLM        like '{@CLM}'" />
	</og:where>
	and   UPPER(CLM)  in ( {@COM_CLMS} )
	and   FGJ       = '1'
	and   KBCLM     != '7'				-- 7:共通 以外(0,1,2 も該当するカラムは、7にする)
--	and   KBCLM     <  '8'				-- 8:有閑 , 9:削除 も含まない
	group by SYSTEM_ID,TBLSYU,CLM
	order by count(*) DESC , CLM
</og:query>

<og:value key="lblKey" value="C" />

<og:hidden name="names" value=",," />
<!-- 7:共通 を設定する。 -->
<og:hidden name="SQL">
	UPDATE GE82 SET
			KBCLM		= '7',
			COMMENTS	= '{@DATE.YMDF} {@LBL.@ACTION}',
			CDKH		= 'C',
			FGJ			= '1',
			DYUPD		= '{@USER.YMDH}',
			USRUPD		= '{@USER.ID}',
			PGUPD		= '{@GUI.KEY}'
	WHERE SYSTEM_ID = '{@SYSTEM_ID}'
	AND   TBLSYU    = '{@TBLSYU}'
	AND   CLM       = [CLM]
</og:hidden>
