If you need to implement MySQL multi-table join query, how can this problem be achieved? The following describes two common methods for implementing MySQL multi-table join query.
MySQL multi-table join query example:
The following two MySQL multi-table join methods can be used, and inner join on is better. The table structure is not pasted out, but it is easy to understand.
A Simple Method for MySQL multi-table join query:
- select c.nom, e.nom
- from consultant c, affaire a, besoin b, salarie sa, site s, entreprise e
- where c.consultant_id=a.consultant_id and a.besoin_id=b.besoin_id and
-
- b.salarie_id=sa.salarie_id and ssa.site_id=s.site_id and s.entreprise_id=e.entreprise_id
The inner join method for MySQL multi-table join:
- select c.nom, e.nom
- from consultant c
- inner join affaire a on c.consultant_id=a.consultant_id
- inner join besoin b on a.besoin_id=b.besoin_id
- inner join salarie sa on b.salarie_id=sa.salarie_id
- inner join site s on ssa.site_id=s.site_id
- inner join entreprise e on s.entreprise_id=e.entreprise_id
-
Take you to understand mysql Variables
How to revoke permissions and delete MySQL users
Back up and restore a database using MySQL Command Line
How does one forget the MySQL root User Password?
How to deal with MySQL function creation Problems