I have two tables with common fields.
One table has all the data I need, say PAYIN and JAN has few records with common fields. I need to query and delete the records from Table A where records have common field in table B.
Eg.
Table: Payin
ID Value Date che_no Amount
5 04/01/2011 205033 2306
6 04/01/2011 216811 1239
7 04/01/2011 335447 1122
8 04/01/2011 216810 630
9 04/01/2011 71918 437
Table: View
ID Value Date che_no cr_amt
5 04/01/2011 205033 2306
8 04/01/2011 216810 630
Required query result
ID Value Date che_no cr_amt
6 04/01/2011 216811 1239
7 04/01/2011 335447 1122
9 04/01/2011 71918 437
Basically, deletes the records that come from the below query from PAYIN.
SELECT PAYIN.CHE_DT, PAYIN.CHE_NO, PAYIN.AMOUNT
FROM PAYIN LEFT JOIN Jan ON (payin.amount=Jan.AMOUNT) AND (PAYIN.CHE_NO=Jan.CHE_NO)
WHERE Jan.CHE_NO IS Null and Jan.AMOUNT is null;
Thank you so much. I am new to sql.