
Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
23.09.2013, 16:39:12
|
|||
|---|---|---|---|
|
|||
finding rownum from result |
|||
|
#18+
Dear Experts i have previously emulated Oracle like rownum in MySQL it works correctly before but at moment: Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. Output: how i can fix it that it shows exact rownum from 1 to end? You can check previous topic for table samples: http://www.sql.ru/forum/1047702/how-to-find-overall-point-of-each-team-from-result Thanks. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
23.09.2013, 17:42:20
|
|||
|---|---|---|---|
finding rownum from result |
|||
|
#18+
Shahriyar.R, It is expected "unexpected" behaviour. Solution is rather simple -- move @row_num:=@row_num+1 and ORDER BY into yet another level of select: Код: sql 1. 2. 3. 4. 5. 6. 7. 8. Observations like this are numerous: moment of evaluation of @variables is not strictly defined except for simplest cases. Apparently GROUP BY and ORDER BY on the same level bring uncertainty here. Divide and conquer :-) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
23.09.2013, 22:02:34
|
|||
|---|---|---|---|
|
|||
finding rownum from result |
|||
|
#18+
javajdbc, Great forum , great people and ofcourse great experts! Thanks :) Works like a charm: Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
23.09.2013, 22:27:36
|
|||
|---|---|---|---|
|
|||
finding rownum from result |
|||
|
#18+
Also rewrite this for using without "set @@row_num=0" Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=47&mobile=1&tid=1835998]: |
0ms |
get settings: |
5ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
42ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
38ms |
get tp. blocked users: |
1ms |
| others: | 200ms |
| total: | 313ms |

| 0 / 0 |
