Grabbing Category's procudts lowest price?

HI Guys,



I have noticed in the new version that the was products are assigned to categories are done in different tables what i am aiming to do is to grab the cheapest list_price of the cheapest product within a category - any idea on how the SQL query would go for this? the function i have written quickly is…







function fn_get_category_price($category_id){
if (!empty($category_id)) {
$category_price = db_get_field("SELECT product_id FROM ?:products_categories WHERE category_id = ?i", $category_id);
$category_price = db_get_field("SELECT MIN(list_price) FROM ?:products", $category_id);
if (!empty($category_price)) {
return $category_price;
} else {
return "";
}
}
return false;
}




I have not tested this yet, but wanted to make sure ive got the right concept in getting that info

I would save myself a little bit of time and review the listing abilities, CS-Cart allows the sorting based upon price, bestsellers, popularity and a few others.



J.

So saying to have a ponder at those queries and how they are done and base using that?