Try to search your question here, if you can't find : Ask Any Question Now ?

Delete the duplicate records from the sql table

HomeCategory: stackoverflowDelete the duplicate records from the sql table
Avatarpushpa asked 2 weeks ago

I have a scenario, I load my 1st file with file_id 8018 into stage table
Then load my 2nd file with file_id 8019 into stage table.

There can be same records what we get in the 1st file.

In the result set i posted, we can see id in (2,3,4) records with file_id 8018 is in the 2nd file with file_id 8019

id  estimatename    market  spotlength  bcastweek   goaldollars file_id
2   3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-08  15499.75    8018
3   3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-15  15499.75    8018
4   3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-22  15499.75    8018
5   3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-24  32453.44    8018
58  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-08  15499.75    8019
59  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-15  15499.75    8019
60  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-22  15499.75    8019
62  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-05  15499.75    8019
63  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-12  15499.75    8019
64  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-19  15499.75    8019

I want my result set to be

id  estimatename    market  spotlength  bcastweek   goaldollars file_id
5   3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-24  32453.44    8018
58  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-08  15499.75    8019
59  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-15  15499.75    8019
60  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-07-22  15499.75    8019
62  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-05  15499.75    8019
63  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-12  15499.75    8019
64  3Q19 CALIFORNIA LOS ANGELES, CA :60 2019-08-19  15499.75    8019

I want to delete the records from 1st file when the same records exist in 2nd file.

1 Answers
Best Answer
AvatarArben answered 2 weeks ago
Your Answer

3 + 18 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com