how can i get the top 3, after i count the column ?
here is my code. to count the no. of the column Total_Fail.
this will give result as below.Code:select count(UUT_SN) as Total_Fail,Fail_Description,Station_No from Muscatel_MPCA_FCT1_LogData_T WHERE SQLDateTime >= '2018-07-01' AND SQLDateTime <= '2018-07-13 'AND Station_No in (19,20,21,22,23,24)and Fail_Description NOT LIKE '%[PASS]%' group by Fail_Description,Station_No ORDER BY Total_Fail DESC
Total_Fail Fail_Description Station_No
8 RR [79] 22
6 RR [79] 20
6 RR [81] 22
6 RR [80] 23
4 RR [80] 22
2 RR [79] 19
2 RR [80] 19
2 RR [80] 20
2 RR [81] 20
2 RR [81] 21
2 RR [78] 23
2 RR [79] 23
2 RR [80] 24
1 RR [6] 24
but i just want to get the top 3 ,how can i do that ?




Reply With Quote
