I use mysql 5.1.72-community.
I have a table named team:
team_id team_name
1 US
1 CH
2 AD
2 JP
2 IT
3 AU
3 CL
3 CU
and a table named person:
person_id address
10051 US. Idaho
10152 US. Connecticut
10053 CH. Aargau
10054 CH. Bern
10055 JP. Tokyo
10056 JP. Ginza
10057 Uneo of JP
Now I want create a view named person_view, like:
person_id address team_id
10051 US. Idaho 1
10152 US. Connecticut 1
10053 CH. Aargau 1
10054 CH. Bern 1
10055 JP. Tokyo 2
10056 JP. Ginza 2
10057 Uneo of JP 2
That means if person.address contains the team.team_name, then person_view.team_id = team.team_id.
How can I do this please?
team_namein theadresscolumn always on the left or right side? Or can it be anywhere in theadresscolumn?