这是查询:
SELECT tbl_product.id, tbl_productspecification.id AS specificationId,
tbl_product.ProductId, tbl_seller.CompanyName, tbl_product.ProductName, tbl_product.Description, mst_Categories.id AS 'Category',
tbl_productspecification.RetailPrice, tbl_productspecification.SalePrice,
tbl_product.image, tbl_productspecification.Discount, tbl_product.EndTime, tbl_product.Seller_Id
FROM tbl_product
LEFT OUTER JOIN tbl_seller ON tbl_seller.SelId = tbl_product.Seller_Id
LEFT OUTER JOIN mst_Categories ON (mst_Categories.id = tbl_product.Category OR mst_Categories.id = tbl_product.SubCategory)
LEFT OUTER JOIN tbl_productspecification ON tbl_productspecification.ProductId = tbl_product.ProductId
LEFT OUTER JOIN mst_image ON mst_image.Product = tbl_product.ProductId
LEFT OUTER JOIN tbl_dealinterest ON tbl_dealinterest.ProductId = tbl_product.ProductId
where tbl_product.Active='y' and tbl_product.StartTime <= '".date("Y-m-d H:i:s")."' and tbl_product.EndTime>'".date("Y-m-d")." 06:00:00'
".$subquery." ".$groupby;
该tbl_dealinterest
表有几个字段:
[BuyerId] [ProductId] [Active]
我需要过滤掉tbl_dealinterest
匹配中的任何记录[BuyerId]
[ProductId]
并且[Active]
不等于n
我尝试了一些东西,但并未列出所有产品tbl_dealinterest
。只有当有人选择一个选项时,它才会被输入。