#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    4
    Rep Power
    0
    Hi, I was wondering whether it would be possible to find out the value of a column of the latest insert and then select all the rows which have the same value in that, all in one query.

    Unclear what I mean? Well, like this:

    1. Find out value of column in latest entry
    2. Select all rows with the same value as the latest entry

    I know how to do this in two calls, but wouldn't it be possible (and faster) to to do it in one call?

    Thanks!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    19
    Rep Power
    0
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    35
    Rep Power
    14


    1. $lastinsert = mysql_insert_id();
    2. select * from yourtablename where yourid = $lastinsert

    ------------------
    Good Good Study
    Day Day Up

Similar Threads

  1. Multiple Selects
    By lazydog in forum PostgreSQL Help
    Replies: 4
    Last Post: February 3rd, 2004, 04:24 PM
  2. using 'count(*)' across multiple selects?
    By freud666 in forum MySQL Help
    Replies: 3
    Last Post: January 21st, 2004, 05:27 AM
  3. Nested / multiple SELECTS or Joins
    By getting_there in forum MySQL Help
    Replies: 2
    Last Post: January 11th, 2004, 04:16 AM
  4. Replies: 3
    Last Post: September 17th, 2003, 05:45 AM
  5. Replies: 3
    Last Post: August 1st, 2003, 11:43 AM

IMN logo majestic logo threadwatch logo seochat tools logo