ソースコード
-- SELECT * FROM ACCESS_LOG WHERE   LOGIN_DATETIME >= '2023-08-01'   AND  LOGIN_DATETIME < '2023-09-01' ORDER BY MEMBER_CODE
-- SELECT date(MIN(LOGIN_DATETIME)) AS LOGIN_DATETIME,MEMBER_CODE FROM ACCESS_LOG WHERE   LOGIN_DATETIME >= '2023-08-01'   AND  LOGIN_DATETIME < '2023-09-01' GROUP BY MEMBER_CODE
-- SELECT date(MIN(LOGIN_DATETIME)) AS LOGIN_DATETIME,MEMBER_CODE FROM ACCESS_LOG GROUP BY MEMBER_CODE

SELECT 
  date(a2.LOGIN_DATETIME) AS FIRST_LOGIN
 ,COUNT(*) AS MEMBER_CNT
FROM (SELECT date(MIN(LOGIN_DATETIME)) AS LOGIN_DATETIME,MEMBER_CODE FROM ACCESS_LOG GROUP BY MEMBER_CODE) a2
WHERE a2.LOGIN_DATETIME >= '2023-08-01' 
  AND  a2.LOGIN_DATETIME < '2023-09-01' 
GROUP BY date(FIRST_LOGIN)
ORDER BY FIRST_LOGIN desc; 

-- SELECT 
--   date(a2.LOGIN_DATETIME) AS FIRST_LOGIN
--  ,COUNT(*) AS MEMBER_CNT
-- FROM (SELECT MIN(LOGIN_DATETIME) AS LOGIN_DATETIME,MEMBER_CODE FROM ACCESS_LOG WHERE   LOGIN_DATETIME >= '2023-08-01'   AND  LOGIN_DATETIME < '2023-09-01' GROUP BY MEMBER_CODE) a2
-- GROUP BY date(FIRST_LOGIN)
-- ORDER BY FIRST_LOGIN desc; 

-- SELECT 
-- date(a2.LOGIN_DATETIME) AS FIRST_LOGIN
-- -- ,a1.MEMBER_CODE
-- -- ,COUNT(a1.MEMBER_CODE) AS MEMBER_CNT
-- ,COUNT(*) AS MEMBER_CNT
-- FROM ACCESS_LOG as a1
-- INNER JOIN (SELECT MIN(LOGIN_DATETIME) AS LOGIN_DATETIME,MEMBER_CODE FROM ACCESS_LOG WHERE   LOGIN_DATETIME >= '2023-08-01'   AND  LOGIN_DATETIME < '2023-09-01' GROUP BY MEMBER_CODE) as a2
--   ON a1.MEMBER_CODE = a2.MEMBER_CODE 
--   AND a1.LOGIN_DATETIME = a2.LOGIN_DATETIME
-- WHERE a1.LOGIN_DATETIME >= '2023-08-01' 
--   AND  a1.LOGIN_DATETIME < '2023-09-01' 
-- GROUP BY date(FIRST_LOGIN)
-- ORDER BY FIRST_LOGIN desc; 
提出情報
提出日時2023/10/15 23:27:14
コンテスト第9回 SQLコンテスト
問題新規ログイン数
受験者Hodgepodge
状態 (詳細)AC
(Accepted: 正答)
メモリ使用量80 MB
メッセージ
テストケース(通過数/総数)
2/2
状態
メモリ使用量
データパターン1
AC
77 MB
データパターン2
AC
80 MB