MySQL Forums
Forum List  »  Newbie

Newbe needs help!
Posted by: Nirgal Nirgal
Date: June 23, 2022 03:11AM

Hello guys! I have just started learning mysql to try to make my job more efficient. I often work with databases for mass market products, but i do it with excel and i have been told that is not very efficient.

I am just now starting to try to apply mysql to solve work problems. Yesterday i receieved a Point of sales database from my boss.

The data base has several different columns, 2 of which are retailer_english and city_english. I need to tell sql to delete all rows that share the same retailer and city, but i am not sure how.

I will make an example, If there are two rows with 7-eleven in new york i need both of them to be deleted. But if there are 2 or more 7-eleven in different cities i need to keep them. Also if there are different retailers in the same city, like in new york you have walmart and carrefour, i need to keep them as well.

I am not sure if I am clear.

For now i wrote this (but it has not worked)

SELECT * FROM practice.listing_analysis
WHERE Retailer_English IN
(SELECT Retailer_English FROM practice.listing_analysis GROUP BY Retailer_English HAVING COUNT(*) > 1)
AND City_English IN
(SELECT City_English FROM practice.listing_analysis GROUP BY City_English HAVING COUNT(*) > 1)
ORDER BY Retailer_English, City_English;

anyone knows how to help?

Options: ReplyQuote

Written By
Newbe needs help!
June 23, 2022 03:11AM
June 23, 2022 10:46AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.