Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Dodanie warunku w klazuli WHERE
seba123
post
Post #1





Grupa: Zarejestrowani
Postów: 57
Pomógł: 1
Dołączył: 20.03.2008

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


Hi, mam takie zapytanie
  1. SELECT post.ID, post.post_title, post.post_date, AVG(rating.rating_rating) AS ocena, COUNT(rating.rating_rating) AS ilosc FROM wp_posts AS post LEFT JOIN wp_ratings AS rating ON(rating.rating_postid = ID) WHERE post.post_type = 'post' && post.post_status = 'publish' GROUP BY post.ID ORDER BY ocena DESC LIMIT 4


I potrzebuje dodać coś na styl WHERE ilosc > 3 - w jaki sposób to wykonać?

Ten post edytował seba123 23.03.2011, 11:35:28
Go to the top of the page
+Quote Post
JoShiMa
post
Post #2





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


To nie WHERE tylko HAVING dodatkowa klauzula (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
seba123
post
Post #3





Grupa: Zarejestrowani
Postów: 57
Pomógł: 1
Dołączył: 20.03.2008

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


Oooo! Dziękuję, zupełnie zapomniałem o tym! (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
san32
post
Post #4





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 18.09.2010

Ostrzeżenie: (20%)
X----




SELECT post.ID, post.post_title, post.post_date, AVG(rating.rating_rating) AS ocena, COUNT(rating.rating_rating) AS ilosc FROM wp_posts AS post LEFT JOIN wp_ratings AS rating ON(rating.rating_postid = ID) WHERE (post.post_type = 'post' && post.post_status = 'publish')and (ilosc > 3 ) GROUP BY post.ID ORDER BY ocena DESC LIMIT 4
Go to the top of the page
+Quote Post

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: 19.12.2025 - 14:22