ソースコード
-- SELECT DISTINCT
--     CUST_CODE AS CODE,
--     CUST_NAME AS NAME,
--     COUNT() AS CNT
-- FROM
--     CUSTOMER AS C
--     INNER JOIN ORDERS AS O ON C.CUST_CODE = O.CUST_CODE
-- WHERE
--     '2023-07-01' <= ORDER_DATE 
--     AND ORDER_DATE <= '2023-07-31'
-- GROUP BY
    
SELECT DISTINCT
    CODE,
    NAME,
    COUNT(CODE) AS CNT    
FROM
(
    SELECT DISTINCT
        C.CUST_CODE AS CODE,
        C.CUST_NAME AS NAME,
        ORDER_DATE
    FROM
        CUSTOMER AS C
        INNER JOIN ORDERS AS O ON C.CUST_CODE = O.CUST_CODE
    WHERE
        '2023-07-01' <= ORDER_DATE 
        AND ORDER_DATE <= '2023-07-31'
) AS temp_tbl
GROUP BY
    CODE
ORDER BY
    CNT DESC,
    CODE DESC
提出情報
提出日時2023/08/21 04:05:59
コンテスト第8回 SQLコンテスト
問題受注件数
受験者leo
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量76 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
75 MB
データパターン2
AC
76 MB