MySQL Forums
Forum List  »  Newbie

select where max id AND ...
Posted by: Martin Thomsen
Date: October 22, 2014 01:39AM

Hi

I am trying to create a select that selects one row based on two different requirements.

so I want to select the contents of "message"..

Here's my first idea:
SELECT message
FROM `jos_agora_posts`

WHERE
(select max(id) from jos_agora_posts) AND topic_id=2

I just get an empty result..

it should do the where based on topic_id=2 and then select the row where id has the highest integer.

Any advice :-)

Options: ReplyQuote


Subject
Written By
Posted
select where max id AND ...
October 22, 2014 01:39AM
October 22, 2014 11:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.