Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2013
    Posts
    68
    Thanks
    28
    Thanked 0 Times in 0 Posts

    How to select latest things from table where ID = something

    I have a table:

    And I want it become like that:


    Please help me. Thank you!

  2. #2
    Regular Coder
    Join Date
    Nov 2011
    Posts
    276
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Can you give your code please?

  3. Users who have thanked Foster for this post:

    hoangthi (10-04-2013)

  4. #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    17,027
    Thanks
    4
    Thanked 2,668 Times in 2,637 Posts
    ORDER BY Sex DESC, ID ASC looks like it matches your resultet.
    "latest" would refer to a timescale of some sorts. There is no reliable methodology of selecting a "latest" record without having a datetime applied to a record. ID is "semi-useful", but not completely reliable.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  5. Users who have thanked Fou-Lu for this post:

    hoangthi (10-04-2013)


 

Posting Permissions

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