The data is as follows:
The current SQL:
(select Max (power), power, companyId, name the from company_domain where companyId=275 group by companyId);
Query the data out is the name for A
how can you remove the name data for B? (according to the power to take out the biggest one, if there are repeated at the top of article 1)
Help!!!!!!!!!!!!!!!
CodePudding user response:
Select the power, companyId, name the from company_domain where power=(select Max (power) from company_domain as b where b.companyId=company_domain.com panyId) and company_domain.com panyId=275 limit 1CodePudding user response:
Select * from company_domain order by companyId desc, power desc limit 1;CodePudding user response:
Select the power, companyId, name the from company_domain where companyId=275 ORDER BY power desc limit 1CodePudding user response:
CodePudding user response:
If it is mysql8.0 (window) can be used to analysis function, if we do not support the analysis function, see using a similar implementation version analysis function, have a lot of,