MySQL Forums
Forum List  »  Newbie

Re: Count in where clause only id's from 2 tables
Posted by: Hassan Yigit
Date: October 02, 2014 07:41AM

Yessss... I have it...

Thanks Peter for the first advice!

$searchrestaurant = "
SELECT restaurants.*, avg(ratings.rating)
FROM restaurants
join ratings on (restaurants.id = ratings.restaurantid)
join deliveryarea on (restaurants.id = deliveryarea.id)
WHERE restaurants.open = '1'
AND restaurants.name like '" . $keyword2 . "'
AND deliveryarea.`" . $quarter . "` <> ''
AND REPLACE(deliveryarea.`" . $quarter . "`, ',', '.') * 1
BETWEEN '" . $orderamountmin . "' AND '" . $orderamountmax . "'
group by restaurants.id
HAVING avg(ratings.rating) > '" . $ratingmin . "'
ORDER BY name ASC";

Options: ReplyQuote


Subject
Written By
Posted
Re: Count in where clause only id's from 2 tables
October 02, 2014 07:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.