Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Last unique inserted row

Last unique inserted row

Scheduled Pinned Locked Moved Database
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I need to retrieve the last inserted row for unique set of columns Got a table with AutoIncrement , Position , status , dateTime where position is a nr form 1 to 20 and status a nr from 1 to 50 The table get updated continuously and I need to now the last status for every position

    M T 2 Replies Last reply
    0
    • A Anonymous

      I need to retrieve the last inserted row for unique set of columns Got a table with AutoIncrement , Position , status , dateTime where position is a nr form 1 to 20 and status a nr from 1 to 50 The table get updated continuously and I need to now the last status for every position

      M Offline
      M Offline
      miah alom
      wrote on last edited by
      #2

      select * from ctm group by AutoIncrement having Position = max(Position) and Status = Max(Status) should do it.

      1 Reply Last reply
      0
      • A Anonymous

        I need to retrieve the last inserted row for unique set of columns Got a table with AutoIncrement , Position , status , dateTime where position is a nr form 1 to 20 and status a nr from 1 to 50 The table get updated continuously and I need to now the last status for every position

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        select * from mytable where myColumn = @@IDENTITY

        see here[^] for more details


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups