pratul — 2011-07-21T22:32:58-04:00 — #1
HI friends..I have a tab delimited text file with country, city, Participants field.. Now, when I search for a particular entry for eg. Country England, then I want it to show all the cities associated with it Inot just one). My actual table looks like this.
Now, If I select England from this MySQL table, then I want MySQL to display me all the corresponding cities for England.
One thing, all the rows with city names of the corresponding country is fixed to three.
I loaded the data using LOAD DATA LOCAL INFILE command to load them from my tab delimited text file. I have attached my .txt file.
Table created using VARCHAR with Default null..
Could you please tell me the appropriate command for this (like if there's any appropriate LIMIT command or something like that)
Thanks for your help..
dan_grossman — 2011-07-21T23:36:20-04:00 — #2
You must populate the Country column in all the rows.
The fact that your query pulls results in that order is not deterministic, it's luck, an artifact; one rebuild of the table file and you won't get them back in that order anymore.
Either edit your .txt file to include the country names with every line, or write a program which inserts the rows with complete data.
pratul — 2011-07-22T14:37:01-04:00 — #3
ok..thanks..I think i got my answer..
samanime — 2011-07-22T19:01:49-04:00 — #4
Keep in mind when dealing with databases that each row is essentially meant to stand on it's own. The order of rows in any specific table has no bearing on anything.