sql >> Databáze >  >> RDS >> Mysql

Jak lze tyto dva příkazy SQL zkombinovat do jednoho?

SELECT p.*
     , c.ID FID_customer
     , o.summe
  FROM os_potential p
  JOIN os_customer c
    ON c.street = p.street 
   AND c.zip = p.zip 
   AND c.city = p.city 
  JOIN 
     ( SELECT FID_customer
            , SUM(price_customer) Summe
         FROM os_order 
        WHERE FID_status = 10
        GROUP
           BY FID_customer
     ) o
    ON o.FID_customer = c.ID
 WHERE p.FID_author = :randomID 
   AND p.converted = 1
   ;


  1. Definování zdroje dat jta mimo kontejner

  2. GROUP BY a ORDER BY

  3. Chyba SQL:'database.table.field is not in GROUP BY

  4. pip freeze poskytuje různé moduly z nápovědy ('modules')