Home > database >  mysql
mysql

Time:10-27

Mysql: X A and B two fields in the table, want to ask for A group, B field to remove the maximum after all records, how to do? Tried to use connection and NOT the EXISTS couldn't query the data, a great god, please help, thanks a lot!

CodePudding user response:

The select t3. * from X t3 where t3. Id not in (
The select t2. Id from (
Select t1. * from X t1 order by t1. B desc
) t2 group by t2. A
)

CodePudding user response:

Select * from X T where (T.A, T.B) not in (select A, Max (B) the from X group by A)

CodePudding user response:

Thanks for above two great god!