SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot jinx3's Avatar
    Join Date
    May 2002
    Location
    Vancouver, WA
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PostgreSQL last id

    With PostgreSQL when using the serial type for the id field of a database table, is there a simple way to get the id field from the last field added???

    I usually just take the information I do know and look for a match and grab the id field. But it seems like there should be an easier way!

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LAST_INSERT_ID() is the function. I'm sure you can squeeze it in to make it work for you.
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Zealot jinx3's Avatar
    Join Date
    May 2002
    Location
    Vancouver, WA
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect, that's what I was looking for!

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you're welcome.
    Aaron Brazell
    Technosailor




Bookmarks

Posting Permissions

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