mysql query: SELECT DISTINCT column1, GROUP BY column2
- by Adam
Right now I have the following query:
SELECT name, COUNT(name), time, price, ip, SUM(price) FROM tablename WHERE time >= $yesterday AND time <$today GROUP BY name
And what I'd like to do is add a DISTINCT by column 'ip', i.e.
SELECT DISTINCT ip FROM tablename
So my final output would be all the columns, from all the rows that where…