SELECT
	*
FROM
	dbo.KlaimFrom_Header
WHERE
  Status = 'G'
ORDER BY
  Create_Date DESC

SELECT
	*
FROM
	dbo.KlaimFrom_Header
WHERE
  App_By = '9999'


--DELETE
--FROM
--	dbo.KlaimFrom_Header
--WHERE
--  App_By = '9999'

  
SELECT
	*
FROM
	dbo.KlaimFrom_Detail
WHERE
  Claim_Ref IN (
                SELECT
	                Claim_Ref
                FROM
	                dbo.KlaimFrom_Header
                WHERE
                  App_By = '9999'
               )
--DELETE
--FROM
--	dbo.KlaimFrom_Detail
--WHERE
--  Claim_Ref IN (
--                SELECT
--	                Claim_Ref
--                FROM
--	                dbo.KlaimFrom_Header
--                WHERE
--                  App_By = '9999'
--               )
               