Ecommerce query

Permalink
Hi,

I'm a clown with mysql, i need help !

I need to keep product filtered by productSet and a attributeKey value. i know that they are the productList model that work fine but it is too slow for my usage. so i would make a query that is really simple
I have this
SELECT pr.productID from CoreCommerceProducts pr 
               left join CoreCommerceProductSearchIndexAttributes on (pr.productID = CoreCommerceProductSearchIndexAttributes.productID) 
               where 1=1
               and (ak_{$akHandle} = '{$value}' OR TRIM(ak_{$akHandle}) LIKE '%{$value}%')
               and pr.prStatus = 1

but my knowledge in SQL can't help me to add the right line to match a productSetID.
Can you help me with that ?

Thank you a lot in advance !!

sebastienj