MySQL Forums
Forum List  »  Newbie

Re: Stuck with what should be simple select query..
Posted by: Don West
Date: April 03, 2017 10:04PM

Actually I got this figured out. Hope it helps others.

data:
ColA-----ColB------------ColC
99---EMAIL3.gmail.com----1023
25---EMAIL1@gmail.com----1456
28---EMAIL2.gmail.com----1456
31---EMAIL1.gmail.com----1456
34---EMAIL3.gmail.com----1456
42---EMAIL6.gmail.com----1116

sql:
SELECT
`ColB`, max(`ColA`) AS `ColA`
FROM
`Tablename`
WHERE
`ColC` = 1456
GROUP BY `ColB`
ORDER BY `ColA`

result:
28-----EMAIL2.gmail.com
31-----EMAIL1.gmail.com
34-----EMAIL3.gmail.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Stuck with what should be simple select query..
April 03, 2017 10:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.