| WANNABE 2006-11-30, 7:14 pm |
| I have been asked to delete some records from an table that will be used in
a data conversion project. But each time I run the query to delete the
selected records I get the following error >>DELETE statement conflicted
with COLUMN REFERENCE constraint 'const_PTCORCUS_fkey
1'. The conflict
occurred in database 'T2', table 'PTCORCUS', column 'PrtId'.
The statement has been terminated.<<
This is the query I am running and I think I need to use an outer join to
discount the records that DO have related records in other Tables.
select binid1, binid2, QtyOH, QtyOO, QtyOT, PTPRT.prtid
--delete PTPRT
FROM PTPRT full OUTER JOIN PTCHG ON PTPRT.PrtId = PTCHG.PrtId, PTPRT full
OUTER JOIN PTCORUS ON PTPRT.PrtId = PTCORUS.PrtId
where (binid1 = 'noloc' or binid1 = '.' or binid1 = '0')
and (binid2 = 'noloc' or binid2 = '.' or binid2 = '0')
and QtyOH = '0' and QtyOO = '0' and QtyOT = '0'
and PTCHG.prtid is null
Can someone PLEASE tell me if this is the right way to do this or is there
a better way, and YOU'LL notice my second join is not right, and I am
currently have a problem remembering how to join the third table, HOW IS
THAT DONE ???
Thank you!!!!
|