Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77

    Unanswered: how to write this update sql statement?

    I have one table with number identity, I want to set its one column value for the last row

    i know i can write it with 2 seperate sql statement like this:
    strSql = "select max(dealNum) from tblm_deal"
    Set rscp = con.Execute(strSql)
    con.Execute strSql
    strSql = "update tblm_deal set modelNum = 3 where dealNum = " & rscp.Fields(0)

    Does anybody know how to write the sql statement in one sentence? such as
    update tblm_deal set modelNum = 3 where dealNum = select max(dealNum) from tblm_deal

    thanks a lot. appreciate for any help

  2. #2
    Join Date
    Sep 2003
    Posts
    228
    Have you thought about using the dmax function within your 2nd SQL statement and then you could eliminate the 1st SQL statement.

  3. #3
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    ottomatic, thanks a lot for help

    sorry, i am new for these,
    how to use dmax?

  4. #4
    Join Date
    Sep 2003
    Posts
    228
    Somebody already showed you how in your duplicate topic...

  5. #5
    Join Date
    Sep 2004
    Location
    Dallas, TX
    Posts
    77
    yeah. search google find the answer for dmax. thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •