2. to select from the result the rownum of the id 11352 for example which it should return 5
now don't tell me to use PHP code to make a counter and check the values, this query has returned only 6 records but if I change the WHERE clause it would return thousends of records, so I want mysql solution please, and I want it for an old mysql server
irisblaze wrote:now don't tell me to use PHP code to make a counter and check the values, this query has returned only 6 records but if I change the WHERE clause it would return thousends of records, so I want mysql solution please, and I want it for an old mysql server
When you say old, which version are you talking about? Not sure if it will help you, but this tidbit from the mysql manual might be of assistance. It is referencing a C API so I'm not sure how it could help you, but it might.
Everah wrote:When you say old, which version are you talking about?
3.23 well.. I have a newer version on my site server, but on my pc i only have that, and mysql is to large (17-36 MB) to download on a hectic internet connection.
You might also want to take a look at the MySQL manual section on functions.
Nothing useful i could find
Last edited by irisblaze on Mon Apr 17, 2006 4:04 am, edited 1 time in total.
How about inserting the selected results into a temporary table with an autoincrement int field and a field to hold 'id'. The SELECT CONCAT(counter, '-', id) FROM tmptable;
arborint wrote:How about inserting the selected results into a temporary table with an autoincrement int field and a field to hold 'id'. The SELECT CONCAT(counter, '-', id) FROM tmptable;
well... this what i'm going to do anyway, it seems no possible way to do what I wanted except this, thanx, but don't you agree with me that mysql developers should present an easy way to do this? after all mysql server goes into a loop to return the results? why we should do the loop again after it's already done?
arborint wrote:How about inserting the selected results into a temporary table with an autoincrement int field and a field to hold 'id'. The SELECT CONCAT(counter, '-', id) FROM tmptable;
well... this what i'm going to do anyway, it seems no possible way to do what I wanted except this, thanx, but don't you agree with me that mysql developers should present an easy way to do this? after all mysql server goes into a loop to return the results? why we should do the loop again after it's already done?
I personally don't see the usefulness of such a function.. I mean, your going to be looping your results anyway when displaying/storing them anyways, correct?
Personally, I always have my db abstraction layer return an array of the selected results, that way I can involk any alterations to the values in one swoop with array_walk()
Jcart wrote:
I personally don't see the usefulness of such a function.. I mean, your going to be looping your results anyway when displaying/storing them anyways, correct?
No not correct, I wanna display 5 results at a time so I'll be using limit start, 5 still I want to know the location of a certain record