i hv a table called ‘album’ with two fields
albumID
albumName
if the row values are like
10 - Wedding
11 - Portrait
corresponding to albumID and albumName.
I would like to get a result like
Sl no Name
1 Wedding
2 portrait.
ie, I want the rownumber to be selected as column
Can any body suggest
This is what I would do in MS SQL. MySql sure have something similar
Select albumID,albumName
from
(
Select Row_Number() over(Order By albumID) As rowNumber
,albumID,albumName
from Albums
) tempData
order by rowNumber
I would select the data ordered by albumID, and create the ‘rownumber’ in PHP (or whatever language you’re using).
r937
4
nope
it’s better to do this in the app anyway, like guido suggested – even in SQL Server
I tried using the row_number(), but doesn’t work. May be my version (2.2) does not support
So do you use MySQL like you say in the post title? Then, like Rudy says, you can’t use row_number (because it doesn’t exist in MySQL).
But, MySQL version 2.2 ?