These are my tables:
Table: People
id---name
1----John
2----Mike
3----George
Table: Visits
id---name---visitor
1----Paris--1
2----Paris--1
3----Paris--1
4----London-1
5----London-1
6----Tokyo--1
Now from those tables we can read that a person named John (id 1) has visited Paris three times, London twice and Tokyo once. Now my question is how could I translate this into SQL and select the name of the most popular place John has visited (result being Paris)?
Aucun commentaire:
Enregistrer un commentaire