Skip to main content
Question

About excel as a database queries


I have one excel file in that I need to get top5 highest values (based on column vaues)into one sheet and top5 lowest values in to one sheet(I need all columns)? Tell me how to write sql query for this​. FYI attaching the excel file.(based on CHNG column need to get this top 5 highest and top 5lowest)

6 replies

Ashwin A.K
Forum|alt.badge.img+8
  • Navigator | Tier 3
  • 2445 replies
  • March 9, 2022

Hi @RAJASIMHA SALLAGUNDLA​ ,

 

Could you check if this logic provides the expected output?

 

SELECT TOP 5 * FROM [Sheet1$$]

ORDER BY [CHNG] DESC;

 

Kind Regards,

Ashwin A.K


Hi Ashwin,

I tried same logic,its giving result but not giving highest CHNG values in descending order. But its giving random values.


Forum|alt.badge.img+6
  • Navigator | Tier 3
  • 142 replies
  • March 9, 2022

Try:

SELECT TOP 5 * FROM [Sheet1$$]

ORDER BY CDbl([CHNG]) DESC;


Hi Aswin, instead of excel as database , using loops and if conditions how we gonna get this..​


No it's not working.​


Andoni_1
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • 85 replies
  • March 10, 2022

You could use:

  • SELECT * FROM [Sheet1$$] ORDER BY CHNG DESC LIMIT 5
  • SELECT * FROM [Sheet1$$] ORDER BY CHNG ASC LIMIT 5

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings