News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

SQL request for ratings and reviews

Started by VB74, Yesterday at 09:45:08 AM

Previous topic - Next topic

VB74

Hello everyone,

I would like the child products in my store to inherit the reviews and ratings of the parent product (ID 22).

Before I do anything stupid, I'd like to make sure that the following SQL query is correct:


QuoteSELECT
    child.virtuemart_product_id AS child_product_id,
    rv.vote,
    rrv.comment,
    rrv.review_rating
FROM
    (SELECT 1 AS virtuemart_product_id UNION ALL
     SELECT 23 UNION ALL
     SELECT 16 UNION ALL
     SELECT 15 UNION ALL
     SELECT 26 UNION ALL
     SELECT 25 UNION ALL
     SELECT 13 UNION ALL
     SELECT 2 UNION ALL
     SELECT 30 UNION ALL
     SELECT 28) child
LEFT JOIN
    ou7s_virtuemart_rating_votes rv
ON
    rv.virtuemart_product_id = 22
LEFT JOIN
    ou7s_virtuemart_rating_reviews rrv
ON
    rrv.virtuemart_product_id = 22;