Hi, look at group by ... with rollup at : http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
Mathias Selon Ronan Lucio <[EMAIL PROTECTED]>: > Hello, > > I have a table where is saved all site´s access: > > access > ==== > id > year > month > day > weekday > hour > minute > ip > > Any column has multiple lines, and I have the follow query > that returns the amount of access per day of month: > > SELECT year, month, day, COUNT(*) AS access > FROM access > WHERE year = 2005 > AND month = 5 > GROUP BY year, month, day > ORDER BY year, month, day > > Now, I need to do the same query, but for unique access, > in other words, with DISTINCT year, month, day, ip. > > I tryed to use the query: > > SELECT year, month, day, ip, COUNT(*) AS access > FROM access > WHERE year = 2005 > AND month = 5 > GROUP BY year, month, day, ip > ORDER BY year, month, day > > but it returns me several lines of the same day and the amount > of access per IP, and I need the amount of access from different > IPs. > > Could anybody help me? > > Ronan > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]