select a.appState, b.prmcde,b.thDesc,b.enDesc,b.prmRef1
	from CBTBCAP024 a,( select prmCde,thDesc,enDesc,prmFlg1,prmFlg2,prmFlg3,prmRef1,prmInt1
						from CBTBGNP901
						where prmtyp = 'APPCASE'
						and recsts = 'A') b
	where a.appCase = b.prmCde 
	--and a.appState = 110
	and a.recsts = 'A'
	and prmRef1<>'Approved'


	 

	--select * from CBMSAPP210 where appState=150 and endTime is null


	--select * from  CBTBCAP024 where  appState>30 and appCase='C13'

	--update CBTBCAP024 set appCase='C17' where appState>30 and appCase='C13'

	--update CBMSAPP010 set appSts='C17' where appstate=997 and appSts='C13'

	select appCase,appSts,* from CBMSAPP010 where  appstate=997 and appSts='C13'