$query_RelatedProducts = sprintf("SELECT * FROM Products WHERE SubCatID IN (".$row_ProductDetails['SubCatID'].") AND ID <> %s", GetSQLValueString($colname_ProductDetails, "int"));
Then when you do a repeat region to display a record from this recordset you can set it to display just 3 results.