Reputation: 13
My query
select max(forum_id) as f_id from forum where topic_id='$fo_id';
We want all row record where forum_id is maximum. My query is as above. We success to get Maximum Forum_id
but We want entire row where max forum_id. Can you help me?
Upvotes: 0
Views: 95
Reputation: 763
You can try
select * from forum where topic_id='$fo_id' order by forum_id desc
I think it will work.
Upvotes: 0
Reputation: 565
You can try below given query.
SELECT * from tabName where `tabId` IN (select MAX(tabId) from tabName);
Upvotes: 1
Reputation: 683
try this:
SELECT * FROM forum WHERE topic_id='$fo_id' ORDER BY forum_id DESC LIMIT 0, 1;
Upvotes: 2