Geo
|
| Posted: 10/12/2005, 4:06 AM |
|
Hi
I would be very pleased if someone will tell me how to extract the position of the record in a recordset in Order By in MySQL 3.23.47.
In other words, I want to extract users info and its(record) position from a table using the Order By . So if I have 10 records in the table, how I could extract its position (1,2,3,..10). I was looking for mysql help but didn't find nothing. Is there a MySQL function?
My example is sorting users' info in a blog website. And I need to affiche this info in order of number points accumulated by every blogger.
Thanks much, Geo
|
|
|
 |
aquarock
|
| Posted: 10/12/2005, 8:39 AM |
|
mysql_query("SET @row=0");
mysql_query("SELECT (@row:=@row+1),f1,f2,f3 as a from table");
|
|
|
 |
aquarock
|
| Posted: 10/12/2005, 8:42 AM |
|
My Mistake:
mysql_query("SET @row=0");
mysql_query("SELECT (@row:=@row+1) AS posno,f1,f2,f3 from table");
|
|
|
 |
Walter Kempees
|
| Posted: 10/12/2005, 8:55 AM |
|
I think aquarock meant:
mysql_query("SET @row=0");
mysql_query("SELECT (@row:=@row+1), f1,f2,f3 AS posno,f1,f2,f3 from table");
"aquarock" <aquarock@forum.codecharge> schreef in bericht
news:5434d2ee337930@news.codecharge.com...
> My Mistake:
>
> mysql_query("SET @row=0");
> mysql_query("SELECT (@row:=@row+1) AS posno,f1,f2,f3 from table");
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|