데이터 분석 전문가로서 지난 3개월 동안 사용자 목록, 라이선스 유형, 사용자가 로그인한 고유 일수를 표시하도록 SQL 쿼리를 작성합니다. 개월당 로그인 수가 가장 많은 것부터 가장 적은 것까지 순서대로 정렬합니다.
응답
WITH DailyLogins AS (
SELECT
Username,
LicenseType,
CAST(LoginTime AS DATE) AS LoginDate
FROM your_table_name
WHERE LoginTime >= DATEADD(month, -3, GETDATE()) -- Filter for last 3 months
),
MonthlyLoginCounts AS (
SELECT
Username,
LicenseType,
COUNT(DISTINCT LoginDate) AS MonthlyLoginCount
FROM DailyLogins
GROUP BY Username, LicenseType
)
SELECT
Username,
LicenseType,
MonthlyLoginCount
FROM MonthlyLoginCounts
ORDER BY MonthlyLoginCount DESC;
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-05-03(UTC)"],[],[]]