how to display products by category in wordpress?
===

I want to display products on the main page based on specific product categories.
I find it difficult to take command in the sql database.
I am confused, where tables are concerned to display products based on the product category.
I tried to take away from this script:

    function mazine_wpsc_category_promo_excludes(){
    	global $wpdb;
    	$exclude_products = $wpdb->get_col("SELECT ID FROM ".$wpdb->posts." JOIN ".$wpdb->postmeta." ON (".$wpdb->posts.".ID = ".$wpdb->postmeta.".post_id) WHERE ".$wpdb->posts.".post_type = 'wpsc-product' AND parent_post = 0 AND".$wpdb->posts.".post_status = 'publish' AND ".$wpdb->postmeta.".meta_key = '_wpsc_special_price' AND ".$wpdb->postmeta.".meta_value = 0 GROUP BY ".$wpdb->posts.".ID ORDER BY ".$wpdb->posts.".post_date DESC");
    
    	return $exclude_products;
    }

but it's a way to display products based on special rates.
I ask for your help