MySQL returned an empty result set

Discussion in 'Databases' started by bumbar, Aug 28, 2010.

  1. #1
    Hallo!

    I have table authors with columns (is_active is true or false):
    ID | name | is_active

    I have sql statement

     
     SELECT *
     FROM `authors`
     WHERE id = ( SELECT MAX( id ) FROM `authors` )
     AND is_active=1 
    
    PHP:
    And I expect to get the name with MAX ID and is_active=1 (true)

    But MySQL returned an empty result set...

    Where is the error?

    Thanx!
     
    bumbar, Aug 28, 2010 IP
  2. Wolf Security

    Wolf Security Peon

    Messages:
    78
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT * FROM authors WHERE is_active=1 ORDER BY id DESC LIMIT 1
    Code (markup):
    What is the output ?
     
    Wolf Security, Aug 28, 2010 IP
  3. bumbar

    bumbar Active Member

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    Thanx!!. Its work.
     
    bumbar, Aug 28, 2010 IP