Why some rows are ascending on year but others are descending although ASC has been specified on year?
select
e.cik,
x."company name",
e.year,
e.quarter,
e.revenue,
e.increment,
e.ratio
FROM
edgar_revenue e
INNER JOIN xbrl as x ON
e.cik = x.cik
AND e.year = x.year
AND e.quarter = x.quarter
WHERE
e.cik IN (SELECT cik from edgar_cik_with_revenue_growth)
AND e.cik NOT IN (SELECT cik from edgar_cik_with_revenue_slump)
AND e.year > 2015
ORDER BY
e.cik, x."company name", e.year asc, e.quarter asc
CodePudding user response:
BK Technologies Corp
sorts before BK Technologies, Inc.
.
Therefore, the first two rows (BK Technologies Corp
) are sorted together, with the year ascending (2021, 2021)
Then there is a single row with BK Technologies, Inc.
, so the sort order doesn't matter.
Then there are three rows with RELM WIRELESS CORP
, which are sorted ascending by year.
Looks perfectly correct! However, it's easy to miss the difference in the company name in the 3rd line.