In this MySQL challenge, the table provided
shows all new users signing up on a specific
date in the format YYYY-MM-DD. Your query
should output the change from one month to
the next. Because the first month has no
preceding month, your output should skip
that row. Your output should look like the
following table.
Answers
Answered by
18
Answer:
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Answered by
15
SELECT
MONTH(L.joindate),
COUNT(L.joindate) - COUNT(R.joindate),
MONTH(R.joindate),
COUNT(R.joindate)
FROM
userlog AS L
LEFT JOIN
userlog AS R
ON MONTH(R.joindate)= (SELECT MIN(MONTH(joindate)) FROM userlog WHERE MONTH(joindate) < MONTH(L.joindate))
GROUP BY (MONTH(L.joindate)),(MONTH(R.joindate));
Attachments:
Similar questions