Web Analytics Made Easy -
StatCounter update last record - CodingForum

Announcement

Collapse
No announcement yet.

update last record

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • update last record

    Code:
    a   b   text
    1   1   t1 
    1   2   t2 
    1   3   t3
    2   4   t4
    ...
    Code:
    update table set text = 'sometext'
    where a = 1 and b = (select max(b) from table where a = 1)
    this does not work -->

    You can't specify target table 'table' for update in FROM clause
    Last edited by BubikolRamios; Apr 8, 2009, 03:19 AM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    found something that works:

    Code:
    update table set text= 'sometext'
    where a= '1'
    order by b desc limit 1
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

    Comment

    Working...
    X