SELECT DISTINCT d.file_id , @rownum := @rownum+1 AS ROW, f.file_title, f.file_name, f.file_type, f.file_size, f.file_owner, f.file_date, d.dl_id,
COUNT(d.file_id) AS CountNFile
FROM download d ,(SELECT @rownum:=0) r
LEFT JOIN file f
ON d.file_id = f.file_id
WHERE file_active != 'off'
GROUP BY d.file_id
ORDER BY d.dl_id ASC