Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MySQL] Problem z grupowaniem pobranych rekordów.
cabana
post
Post #1





Grupa: Zarejestrowani
Postów: 88
Pomógł: 0
Dołączył: 25.05.2010

Ostrzeżenie: (0%)
-----


Witam. Mam problem z grupowaniem pobranych rekordów. mysql_error() zwrócił mi tylko komunikat "Invalid use of group function" i nie mam pojęcia dlaczego on się pokazuje.
Moje zapytanie wygląda tak:

  1. $query = sprintf('
  2. SELECT
  3. REQ_PAGE, COUNT(REQ_PAGE) AS TOTAL
  4. FROM
  5. %sSITE_ACCESS
  6. WHERE
  7. DATE(ACCESS_TIME) BETWEEN
  8. "%d-%02d-01" AND
  9. "%d-%02d-01" + INTERVAL 1 MONTH - INTERVAL 1 DAY
  10. GROUP BY
  11. REQ_PAGE
  12. ORDER BY
  13. TOTAL DESC
  14. LIMIT 5',
  15. DB_TBL_PREFIX,
  16. $full_year,
  17. $num_month,
  18. $full_year,
  19. $num_month);


a tutaj struktura tabeli:

  1. CREATE TABLE `page_SITE_ACCESS` (
  2. `ACCESS_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  3. `IP_ADDRESS` varchar(255) collate latin1_general_cs NOT NULL DEFAULT '',
  4. `REQ_PAGE` varchar(255) collate latin1_general_cs NOT NULL DEFAULT '',
  5. PRIMARY KEY (`ACCESS_TIME`)
  6. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs;
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.09.2025 - 07:48