Hi
I have the following query (which seems to work).
SELECT i.interest, af.annualfee
FROM (SELECT (AVG(pa.pr_att_value)) AS interest FROM pratt AS pa, product AS p WHERE p.product_id = pa.product_id AND p.pr_status = 1 AND pa.pr_ty_att_label = "Interest Rate") AS i
, (SELECT (AVG(pa.pr_att_value)) AS annualfee FROM pratt AS pa, product AS p WHERE p.product_id = pa.product_id AND p.pr_status = 1 AND pa.pr_ty_att_label = "Annual Fee") AS af
I plan to add further “averages”, but before I do this, I was wondering if there was a better (more efficient?) way of doing this?
Thanks