MySQL Forums
Forum List  »  Newbie

Re: mysql - count records after ORDER BY
Posted by: Peter Brawley
Date: September 27, 2018 03:25PM

> Two tables are joined and I added the code to count records.

The query you post is confusing. To join tables a and b and count the result would be, minimally ...

select count(*) from (
select a.aid,b.bid
from a
join b on a.aid=b.bid
) x;

> The issue is that I want to first ORDER BY SN and assign cnt after?

Unclear. So is the query you post. Please post a clear complete statement of your query requirement.

Options: ReplyQuote


Subject
Written By
Posted
Re: mysql - count records after ORDER BY
September 27, 2018 03:25PM


Sorry, only registered users may post in this forum.

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.