in reply to Increase a value inside MySQL query using perl
My query is if the table.ID equal to 5, set the first one to 10, then the second one 11 and the third one 12 and so on
Actually, a database accessed by SQL has no concept of "first one" or "next one". Whichever record is returned "first" (or "next") is not strictly defined. It may be the same every time or may be different, subject to unknown variables, hidden rules or the phases of the moon.
If you want to impose "order" into this chaos, you must ask the database engine to sort the records for you ("ORDER BY clause").
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Increase a value inside MySQL query using perl
by chacham (Prior) on Oct 14, 2015 at 15:11 UTC | |
by CountZero (Bishop) on Oct 14, 2015 at 18:51 UTC | |
by chacham (Prior) on Oct 14, 2015 at 20:51 UTC | |
by CountZero (Bishop) on Oct 15, 2015 at 18:46 UTC | |
by chacham (Prior) on Oct 15, 2015 at 19:02 UTC | |
|