I am running following query in mysql and it is giving me just "1" as row_num instead of auto incrementing it. Can anyone please guide me what is wrong
SELECT ROW_NUMBER() OVER(PARTITION BY DISEASEIDPK) AS row_num,COUNT(*) PATIENTSAVAILABLE, DISEASEIDPK,
(Select DISEASENAME from doctorsoncallschema.diseases d where d.DISEASEIDPK = doctorsoncallschema.patients.DISEASEIDPK) as DISEASENAME
FROM doctorsoncallschema.patients
GROUP BY DISEASEIDPK ORDER BY row_num ASC;
Result

It looks like you want to order using the
DISEASEIDPKcolumn, rather than partitioning by it. If so, then use:Using
PARTITION BY DISEASEIDPKmeans that every record having the sameDISEASEIDPKvalue will be assigned the same row number.