In this table 3 records share the same state value:
name | state | country
---------------------
Jake | NY | US
Lisa | PH | US
Bob | NY | US
Jake2 | NY | US
If I use:
SELECT DISTINCT * FROM myTable
The result would be:
Jake | NY | US
Lisa | PH | US
Bob | NY | US
Jake2 | NY | US
I need:
Jake | NY | US
Lisa | PH | US
How can I get all the distinct rows from a table based on the value of one particular column (state)?
I need
Jake | NY | US
Lisa | PH |
Bob | NY |
Jake2 | NY |
Try a
Group By. In this case :