Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
for a table like this
id|col 1 |a 2 |b 3 |a
I would like to get an array of just col elements ordered by how often they appear in the table. how can this be done?
SELECT ARRAY(SELECT col FROM yourTable GROUP BY col ORDER BY COUNT(*) );
Add a comment
ORDER BY COUNT(*) DESC
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.