Adsense
Popular Posts
- jQuery autocomplete scroll bar for dropdown menu
- mod_auth_cas.so error: undefined symbol: SSL_connect
- JavaScript Arrays and Associate Arrays
- Design date and signature box in Latex
- Install APXS in Redhat Linux
- JavaScript, remove trailing insignificant zeros after toFixed function
- jQuery, toggle the display
- Difference between state and props in React
- super(props) in React
- MySQL workbench -"Could not decrypt password cache"
Wednesday, July 16, 2014
select distinct for composite key in MySQL using GROUP BY
For example,we have users table and containing firstname and lastname.
We can select distinct lastname using:
SELECT DISTINCT lastname FROM users
What happen if we want to see distinct of combination of firstname and lastname?
We can use GROUP BY as following
SELECT lastname, firstname FROM users GROUP BY lastname, firstname
Labels:
MySQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment