<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:head headType="result" />
<jsp:directive.include file="/jsp/custom/result_info.jsp" />
<og:comment
	system	= "GF:エンジンサンプル"
	pgid	= "GF2090"
	title	= "テーブル差分"
	date	= "2008/10/27"
	author	= "Hiroki.Nakamura"
	text	= ""
	version	= "001"
/>

<og:columnCheck
	command   = "{@command}"
	columns   = "SYSTEM_ID1,SYSTEM_ID2,TABLE_NAME1,TABLE_NAME2"
/>

<!-- 取り消しボタンが押された時に必要です。 -->
<og:entry command = "{@command}" />

<og:value command="SET" key="c_keys" value="{@compareKeys}" action="APPEND" />

<og:query command="{@command}" debug="{@debug}" maxRowCount="{@maxRowCount}">
	<jsp:text>
		select *
		from {@TABLE_NAME}
		where (    ( SYSTEM_ID='{@SYSTEM_ID1}' and TBLSYU='{@TBLSYU1}' and '1'='{@USED_1}' )
				or ( SYSTEM_ID='{@SYSTEM_ID2}' and TBLSYU='{@TBLSYU2}' and '1'='{@USED_2}' ) )
		and   FGJ in ('0','1')
		and   ( {@c_keys} ) in (
		  (
			select	{@c_keys}
			from	{@TABLE_NAME}
			where SYSTEM_ID   =   '{@SYSTEM_ID1}'
			and   TBLSYU      =   '{@TBLSYU1}'
			and   FGJ         in  ('0','1')
			and   TABLE_NAME  like '{@TABLE_NAME1}%'
			union
			select	{@c_keys}
			from	{@TABLE_NAME}
			where SYSTEM_ID   =   '{@SYSTEM_ID2}'
			and   TBLSYU      =   '{@TBLSYU2}'
			and   FGJ         in  ('0','1')
			and   TABLE_NAME  like '{@TABLE_NAME2}%'
		  )
			minus
		  (
			select	{@c_keys}
			from	{@TABLE_NAME}
			where SYSTEM_ID   =   '{@SYSTEM_ID1}'
			and   TBLSYU      =   '{@TBLSYU1}'
			and   FGJ         in  ('0','1')
			and   TABLE_NAME  like '{@TABLE_NAME1}%'
			intersect
			select	{@c_keys}
			from	{@TABLE_NAME}
			where SYSTEM_ID   =   '{@SYSTEM_ID2}'
			and   TBLSYU      =   '{@TBLSYU2}'
			and   FGJ         in  ('0','1')
			and   TABLE_NAME  like '{@TABLE_NAME2}%'
		  )
		)
		order by {@c_keys},TBLSYU,SYSTEM_ID
	</jsp:text>
</og:query>

<og:view
	viewFormType = "HTMLTable"
	command    = "{@command}"
	noDisplay  = "FGJ,UNIQ"
	checked    = "{@checked}"
	startNo    = "{@startNo}"
	pageSize   = "{@pageSize}" />

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
