Limiting the output of specific column sql hana
I have a table structure as given below and what I'd like to be able to do
is retrieve the top three records with the highest value for each Company
code.
I've googled and I couldn't find a better way so hopefully you guys can
help me out.
By the way, I'm attempting this in MySQL and SAP HANA. But I am hoping
that I can grab the "structure" if the query for HANA if I can get help
for only MySQL
Thanks much!
Here's the table:
¨X¨T¨T¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨j¨T¨T¨T¨T¨T¨T¨T¨[
¨U Company ¨U Plant ¨U Value ¨U
¨d¨T¨T¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨p¨T¨T¨T¨T¨T¨T¨T¨g
¨U 1 ¨U A ¨U 3 ¨U
¨U 1 ¨U B ¨U 4 ¨U
¨U 1 ¨U C ¨U 5 ¨U
¨U 1 ¨U D ¨U 2 ¨U
¨U 1 ¨U E ¨U 3 ¨U
¨U 1 ¨U F ¨U 1 ¨U
¨U 1 ¨U G ¨U 3 ¨U
¨U 2 ¨U A ¨U 1 ¨U
¨U 2 ¨U B ¨U 2 ¨U
¨U 2 ¨U C ¨U 5 ¨U
¨U 2 ¨U D ¨U 3 ¨U
¨U 2 ¨U E ¨U 2 ¨U
¨U 2 ¨U F ¨U 2 ¨U
¨U 2 ¨U G ¨U 6 ¨U
¨U 3 ¨U A ¨U 7 ¨U
¨U 3 ¨U B ¨U 3 ¨U
¨U 3 ¨U C ¨U 1 ¨U
¨U 3 ¨U D ¨U 2 ¨U
¨U 3 ¨U E ¨U 8 ¨U
¨U 3 ¨U F ¨U 2 ¨U
¨U 3 ¨U G ¨U 3 ¨U
¨^¨T¨T¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨m¨T¨T¨T¨T¨T¨T¨T¨a
No comments:
Post a Comment