Posted - 12/03/2024 : 11:02:00
Thanks, that tip is helpful! I found that many people were saying that I could wrap the subquery like this: (select * from (SELECT pNumSales FROM products ORDER BY pNumSales DESC LIMIT 8) as SUBQUERY) One more question if you happen to know. In a subquery situation, would I be SELECT for pNumSales or pID...or am I not even close? $customsortby_04='CASE pNumSales IN (select * from (SELECT pID FROM products ORDER BY pNumSales DESC LIMIT 8) as SUBQUERY) THEN 0 WHEN pCustom8 = TRUE THEN 1 ELSE 2 END, pNumSales DESC, pPopularity DESC'; OR $customsortby_04='CASE pNumSales IN (select * from (SELECT pNumSales FROM products ORDER BY pNumSales DESC LIMIT 8) as SUBQUERY) THEN 0 WHEN pCustom8 = TRUE THEN 1 ELSE 2 END, pNumSales DESC, pPopularity DESC'; Thanks for your help!! Edit: I am guessing that part of my issue is maybe the scope? I am obviously wanting to subquery through the existing results, but perhaps the way this new subquery is written it is taking a query of all of the records in the products table, not just the ones that are already selected.
Edited by - atlend on 12/03/2024 11:36:07
|