programing

JSON_EXTRACT SUM 함수

fastcode 2023. 8. 28. 22:25
반응형

JSON_EXTRACT SUM 함수

저장된 데이터입니다.저는 "총계"의 합계가 필요합니다. 기본적으로 저는 전체 매출액을 가져와야 합니다.

enter image description here

여기 0을 반환하는 제 쿼리가 있습니다.sum 기능을 사용하는 방법에 대해 읽었는데 작동하지 않습니다.

USE pharmacy_db;

SELECT SUM(JSON_EXTRACT(Invoice, "$[*].total")) AS sales
FROM sales;

enter image description here

언급URL : https://stackoverflow.com/questions/59063933/json-extract-sum-function

반응형