Hello, I'm trying to print out the ranking on mysql.
SELECT * FROM (
SELECT
cu_distribution,
count(cu_status),
@curRank := @curRank + 1 AS rank
FROM
cs_customer p, (SELECT @curRank := 0) r where cu_status=1
group by cu_distribution order by count(cu_status)) AA
View results
That's what happens. Why is that?
mysql php
I worked on it for hours today, and it finally worked out. If you're stuck like me, please do it like below.
SELECT cu_distribution, status, @Rank:=@Rank + 1 ASuser_rank
FROM
(
SELECT cu_distribution, count(cu_status) AS status
FROM cs_customer
where cu_status=1
GROUP BY cu_distribution
ORDER BY status DESC
) Sub1
CROSS JOIN (SELECT @Rank:=0) Sub2
You can do it like this.
890 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
600 GDB gets version error when attempting to debug with the Presense SDK (IDE)
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
568 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.