매주 요일별 판매 합계를 매월 합산하려고합니다. Access의 Weekday 기능을 사용하여이 작업을 수행 할 수 있다고 생각합니다. 아래 쿼리의 Weekday 함수 코드가 작동하지 않습니다. Weekday 함수 구문을 매주 판매 합계를 합산하기 위해 어떻게 수정해야합니까? (아래의 쿼리는 올바른 코드로 업데이트되어 올바른 결과를 반환합니다.) 당신은 평일 기능을 사용하여 매개 변수의 실제 비교 안하고있는 것처럼액세스, 월별로 각 요일에 대한 총계 합계
SELECT Format(DatePart("m",months.month_start),"00") & "/" & Year(months.month_start) AS [Month/Year],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 1) AS [Sunday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 2) AS [Monday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 3) AS [Tuesday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 4) AS [Wednesday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 5) AS [Thursday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 6) AS [Friday Sales Total],
(SELECT Round(Nz(Sum(sales_receipt.SELLING_PRICE*sales_receipt.quantity),0),2)
FROM SALES_RECEIPT
WHERE SALES_RECEIPT.SALE_DATE between months.month_start and months.month_end and weekday(sale_date) = 7) AS [Saturday Sales Total]
FROM (SELECT DateSerial(Year(sale_date), Month(sale_date), 1) AS month_start,
DateAdd("d", -1, DateSerial(Year(sale_date), Month(sale_date) + 1, 1)) AS month_end
FROM SALES_RECEIPT
WHERE sale_date between #1/1# And #12/31#
GROUP BY Year(sale_date), Month(sale_date)) AS months;
는 "작동하지 않습니다"의 증상을 설명 실제 필드에게 팝업을 제거하고 사용합니다. 원하는 모양의 샘플 데이터 세트 및 실제로 나오는 내용 – dbmitch
쿼리가 실행되면 "날짜 값"을 묻는 "ENTER PARAMETER VALUE"상자가 나타납니다. 일요일 인 1의 date_value를 입력하면 1 월의 각 요일은 $ 2016.62 ($ 2016.62는 1 월의 모든 31 일 동안의 판매 합계입니다)의 값을 갖습니다. 상점은 일요일에 닫혀 있기 때문에 일요일은 $ 0이어야합니다. 일요일을 제외하고는 매일 2016.62 달러 미만이어야하지만, 1 월의 각 요일의 합계는 2016.62 달러가되어야합니다. –