I am developing a custom module which will enhance the magento reviews and rating, now i have created a custom table which will count votes on reviews(facebook comment like).
Now i have to convert the following sql query into magento query format, but i don't know how can i do this.
SELECT review_id, COUNT(*) FROM reviews GROUP BY review_id, votes HAVING review_id=(SELECT review_id FROM reviews WHERE vote_id='<7>') AND votes='<1>'
point to remember is that, i have to do this using event observer not in models