내 표에서 특정 값의 합계 및 개수를 찾고 싶습니다.기본 SQL Select 문 - 합계는 어떻게 찾습니까?
내 특정 상황에서이 테이블은 product
이라고합니다. 테이블의 열 이름은 'id
, product_id
, quantity
및 shipping_price
입니다.
표에는 다음이 포함됩니다 (SELECT * FROM product;
기준) 내가 같은 product_id
과 행의 양을 선택 quantity
, end_price
및 shipping_price
의 합을 얻을 것이다 SQL 문을 필요
product_id:1 quantity:1 end_price:15 shipping_price:1
product_id:2 quantity:2 end_price:15 shipping_price:0
product_id:1 quantity:1 end_price:15 shipping_price:1
product_id:2 quantity:1 end_price:15 shipping_price:0
product_id:1 quantity:1 end_price:15 shipping_price:1
product_id:3 quantity:1 end_price:15 shipping_price:0
. 항목 1 내가 반환에 SQL 문을하려면이 예를 들어
는 :product_id:1 quantity:3 end_price:45 shipping_price:3