我建這個SQL請求,意外的結果與ROW_NUMBER做內部聯接
SELECT
distinct c_users.id,
c_photos.user_id,
c_photos.pic_filename,
c_users.user_first_name,
c_users.user_last_name,
c_users.description,
c_users.curriculum_diploma_1,
ROW_NUMBER() OVER(ORDER BY c_users.id ASC) AS rank
FROM
c_users
INNER JOIN
c_photos
ON
c_users.id=c_photos.user_id
WHERE
lower(location_town) LIKE '%lille%'
AND
(c_photos.pic_type='profile' OR c_photos.pic_type='photo')
LIMIT
9
;
這是輸出,
秩列有一些意想不到的結果,我希望它是1,2,3等,而不是94,84,25等。我不知道該怎麼做。
感謝,
倫納德