Create a single query to give me some statistics from a mysql table

Виконано Опубліковано %project.relative_time Оплачується при отриманні
Виконано

I have a table, "documents", which is continuesly filled with data. The field "in_date" is a datetime-field.

I need the following:

How many documents are in the table from this week, grouped by [login to view URL]

How many documents are in the table from last week, grouped by [login to view URL]

I can see the number of documents this week by doing this query:

SELECT COUNT(md5sum) AS c, myndighet FROM `document` WHERE YEARWEEK(in_date) = YEARWEEK(CURRENT_DATE) GROUP BY myndighet

But in the same query I also need a COUNT of how many documents where in from last week.

Very important that it's done in one query only.

A sample .sql file is provided.

MySQL

ID Проекту: #7676608

Про проект

1 заявка Дистанційний проект Остання активність May 15, 2015

Доручено:

Ayan

Hello, I can write this query up really quickly. Please let me know when we can discuss. Thanks you.

€12 EUR / година
(5 відгуків(-и))
2.1