Re: MySQL output corresponding rows
You have 2 cities, London and Taunton, with a country of England. You have 4 cities, Exeter, Leeds, Bristol and Plymouth (along with Melbourne, Kolkata and Mumbai) that have no countries. Your data is corrupt. Add the proper country to each row.
Then your select statement will be
"SELECT Cities FROM test2 WHERE Country = 'England';"
If you also want the country, make that
"SELECT Country, Cities FROM test2 WHERE Country = 'England';"
You can't select a blank country from a record that has a non-blank country, and you can't select based on a country if the record's Country field is blank.
If you want it displayed your way you'll have to write code (PHP if it's a website), to display the country name every third line. (You could also write some fairly complex SQL to do that.)
|