Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mysql] Problem ze złożonym zapytaniem, GROUP BY
tommy4
post
Post #1





Grupa: Zarejestrowani
Postów: 288
Pomógł: 12
Dołączył: 2.12.2005

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


  1. SELECT n.title AS ntitle, n.content AS ncontent, n.id AS nid, n.longcontent AS nlongcontent,
  2. n.date AS ndate, u.avatar AS uavatar, n.comments AS ncomments, n.sourceaddress AS nsourceaddress,
  3. n.sourcename AS nsourcename, n.lev AS nlev, n.onlyfor AS nonlyfor, u.nick AS nauthor,
  4. u.gang AS ngang, u.lev AS ulev, u.id AS uid, COUNT(c.id) AS commentscount FROM news AS n,
  5. users AS u INNER JOIN comments AS c ON c.what='N'
  6. WHERE u.id = n.author AND c.id_what = n.id
  7. GROUP BY n.id ORDER BY n.date DESC LIMIT 11


Te o to zapytanie nie zwraca mi niestety newsów, które nie mają komentarzy. (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Czy ktoś wie, jak to naprawić?


---------------------
poprawiłem kod,
aby strona się nie rozjeżdżała
~Cienki1980
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
tommy4
post
Post #2





Grupa: Zarejestrowani
Postów: 288
Pomógł: 12
Dołączył: 2.12.2005

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


nadal nic
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: 8.10.2025 - 15:18