horseturtle Posted March 11, 2011 Share Posted March 11, 2011 Hi, I have a table with three fields - City, Country and Population. I am using a SELECT to list all possible combination's of each Country and City. SELECT c1.Name, c1.Country, c2.Name, c2.Country FROM City AS c1, City AS c2 WHERE c1.Country != c2.Country; However when I use this command I get duplicate combination's for each, eg. City A | Country A | City B | Country B City B | Country B | City A | Country A How can I alter the WHERE clause to stop this happening? Quote Link to comment https://forums.phpfreaks.com/topic/230295-altering-where-clause-to-avoid-duplicate-entries/ Share on other sites More sharing options...
fenway Posted March 11, 2011 Share Posted March 11, 2011 That doesn't make sense -- you can't random mix cities from one country with another country??? Quote Link to comment https://forums.phpfreaks.com/topic/230295-altering-where-clause-to-avoid-duplicate-entries/#findComment-1185984 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.