0

Dear All,

I am new to MySQL. Can i retrive the result of a query as the combination of different fields of a single record..

For example..
if the result record of a query is ... id(1), country(India), Location1(maharashtra), Location2(pune), Location3(Navi Mumbai)...

My doubt is that can i retrive the 3 locations as one field..

Please excuse me if this is a foolish question..

Regards,

Jino..

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by silviuks
0

If I understand correctly you want people to search for "muharashtra" or "pune" and get "india" as the result?

What I would do is setup 2 mysql tables in the one database.

1 called "countries"
1 called "cities"

like so:

countries
country_id
country_name

cities
city_id
country_id
city_name

You can now do something along the lines of:

$sql = "SELECT countries.name FROM countries,cities WHERE countries.country_id=cities.country_id AND cities.city_name LIKE '%$SEARCH_STRING%'";

Comprende?

0

you can try something like this:
SELECT Column1 & ' ' & Column2 AS Name FROM ....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.