sql >> Database teknologi >  >> RDS >> Mysql

mySQL:Sammenføjning af tre borde - hvordan?

SELECT `manufacturers`.*, `languages`.*, COUNT(`products`.`id`) AS NumberOfProducts
FROM (`manufacturers`)
JOIN `languages` ON `manufacturers`.`lang` = `languages`.`id`
LEFT OUTER JOIN `products` ON 
      `products`.`manufacturerid` =  `manufacturers`.`manufacturerid`
GROUP BY <Column list for manufacturers AND languages here>
ORDER BY `languages`.`id` asc, `manufacturers`.`id` asc


  1. Kan en sql-servertabel have to identitetskolonner?

  2. Hvordan opretter man en database i SQL?

  3. MySQL SUM HVIS felt b =felt a

  4. Opdel en mysqldump-fil med flere databaser efter database