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.
[IMG]http://i56.tinypic.com/2dceg4p.jpg[/IMG]
Now, If I select England from this MySQL table, then I want MySQL to display me all the corresponding cities for England.
Like this:
[IMG]http://i56.tinypic.com/1zbyoep.jpg[/IMG]
Not this:
[IMG]http://i51.tinypic.com/2lvntsm.jpg[/IMG]
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..
ghosh22
0
Junior Poster in Training
Recommended Answers
Jump to Postinstead of using load file, you directly read file using php and insert records directly to mysql.
while reading file in code, if you find blank country, then you may set country to country of previous record.
All 4 Replies
urtrivedi
276
Nearly a Posting Virtuoso
ghosh22
0
Junior Poster in Training
urtrivedi
276
Nearly a Posting Virtuoso
d5e5
commented:
Good advice. Need to pre-process data with procedural language, such as php or Perl.
+9
ghosh22
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.