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
    34
    Thanks
    18
    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
    Regular Coder
    Join Date
    Nov 2011
    Posts
    250
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Can you give your code please?

  • Users who have thanked Foster for this post:

    hoangthi (10-04-2013)

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 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'); 

  • 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
    •