Having trouble accessing the rest of the row with MySQL MAX function -


im trying return different column on row returned max function. instance have table eggs => 10 , bacon => 20. i'm trying return eggs or bacon based on value. i've tried this:

select column1, max(column2) table 

i can't seem access value of column1. missing max function?

answer:

select column1, max(column2) col2 table group column1 order col2 

you want apply max() aggregate function on group of data:

select column1, max(column2)  table group column1 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -