2 added 101 characters in body
source | link

I have a php page where user can select multiple locations like USA, UK, Finland etc

At the moment i am storing all the data in mysql table comma separated. It is working fine but when i try to get count for individual locations i am having problem to write sql query.

I want to know what is the best way to save multiple locations in db table.

Edit: Sample data

Location
India
UK,Finland, India
USA, NZ, AUS, Spain

Please advise.

select l.location, count(*)
from posting l join
     posting p
     on find_in_set(l.location, p.location) > 0;

I have a php page where user can select multiple locations like USA, UK, Finland etc

At the moment i am storing all the data in mysql table comma separated. It is working fine but when i try to get count for individual locations i am having problem to write sql query.

I want to know what is the best way to save multiple locations in db table.

Please advise.

select l.location, count(*)
from posting l join
     posting p
     on find_in_set(l.location, p.location) > 0;

I have a php page where user can select multiple locations like USA, UK, Finland etc

At the moment i am storing all the data in mysql table comma separated. It is working fine but when i try to get count for individual locations i am having problem to write sql query.

I want to know what is the best way to save multiple locations in db table.

Edit: Sample data

Location
India
UK,Finland, India
USA, NZ, AUS, Spain

Please advise.

select l.location, count(*)
from posting l join
     posting p
     on find_in_set(l.location, p.location) > 0;
1
source | link

design table to store country name

I have a php page where user can select multiple locations like USA, UK, Finland etc

At the moment i am storing all the data in mysql table comma separated. It is working fine but when i try to get count for individual locations i am having problem to write sql query.

I want to know what is the best way to save multiple locations in db table.

Please advise.

select l.location, count(*)
from posting l join
     posting p
     on find_in_set(l.location, p.location) > 0;