<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  GF80
	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     != '5'				-- 5:共通 以外(0,1,2 も該当するカラムは、5にする)
--	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=",," />
<!-- 5:共通 を設定する。 -->
<og:hidden name="SQL">
	UPDATE GF80 SET
			KBCLM		= '5',
			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>
