MySQL 단일 행에서 여러 열의 AVG를 선택하는 방법
여러 열의 평균을 선택하려면 어떻게합니까? 다음과 같은 데이터가 있다고 가정합니다. X Y Z ------------- 6 3 3 5 5 NULL 4 5 6 11 7 8 나는 같은 것을 얻고 싶다. AVG ------------- 4 5 5 8.66666667 select avg (x, y, z) from table 을 시도했습니다. 하지만 작동하지 않습니다. 쿼리에 대한 아이디어가 있습니까? 해결 방법 시험 Select (Coalesce(x,0) + Coalesce(y,0) + Coalesce(z,0)) / (Coalesce(x/x, 0) + Coalesce(y/y, 0) + Coalesce(z/z, 0)) 또는 Select (Coalesce(x,0) + Coalesce(y,0) + Coalesce(z..
2020. 10. 27.
MySQL WHERE 절 MYSQL의 ISNULL (값, 0)
이 요청이 있습니다. SELECT sc.no, scl.quantite, scl.description, scl.poids, scl.prix, sl_ref.refsl, sl_ref.codetva, sl_ref.tauxtva, sl_ref.compte FROM shop_commande AS sc, shop_commande_ligne AS scl, selectline_ref AS sl_ref WHERE sc.id = scl.shop_commande_id AND sl_ref.refshop = ISNULL(scl.shop_article_id, 0) AND sc.id NOT IN (SELECT id_command FROM selectline_flag) 때때로 sl_shop_article_id 에 NULL 값이 있습니..
2020. 10. 26.