Right now I have the following query:
SELECT name, COUNT(name), time, price, ip, SUM(price) FROM tablename WHERE time >= $yesterday AND time <
you can use COUNT(DISTINCT ip), this will only count distinct values
COUNT(DISTINCT ip)