I need to add another AND condition to this but from another table is this possible to add the condition??
currently my mysql query is:
$category_min_price = db_get_field("SELECT min(price) FROM ?:product_prices p, ?:products_categories c WHERE p.product_id=c.product_id AND c.category_id = ?i",$category_id);
but i need to check if the product is active in the above statement which is located in another table, details are as follows:
table: ?:products
col: status
if it was seperate would be FROM ?:products WHERE product_id = "ID" AND status = "A"
anyone know how i can merge that in to the above query, as at the moment it gets the min price but gets the min price for even disabled products so need to add that status condition in to only do active products
Many thanks in advanced!
Do joins, my good sir.
What you’ve got there are cross joins. While you can do them ad nauseum, just like with inner joins (or any join, really), it’s not very clear what’s getting joined to what.