I had a select box where the user will select the list of cities they travelled. After that the admin will search for the users with particular cities.
I am very confused with the structure of the database. There are totally 300 cities. Creating column for each city and store it with boolean on or off, looks a childish technique. Any one help me plz
Not sure why you’ve tagged this both
mysqlandsql-server– are you using both?Anyway, this is a standard many-to-many mapping:
Table: User
Table: City
Table: UserCity
To retrieve all of the cities for a given user: