从MYSQL PHP中的特定类别中排除项目

时间:2013-04-10 09:38:33

标签: php mysql

以下代码将获取我数据库中所有类别的所有最新项目。我想隐藏特定类别中的所有项目,因此它不显示该特定类别的项目,但仍显示其他类别的项目。

$query="
SELECT t1 . *,
DATEDIFF( t1.date_added, '$curDate' ) as remaining,
at.auctions_type_name
FROM wp_mam_auctions AS t1
INNER JOIN wp_mam_auction_type AS at ON at.auctions_type_id = t1.auction_type_id
WHERE  t1.auction_status_id = '1' AND t1.sold='0'
AND DATEDIFF( t1.date_added, '$curDate' ) <= '0'
AND DATEDIFF( t1.date_added, '$curDate' ) >= '-$new_listing_days'
AND TIMESTAMPDIFF(MINUTE , '$curDate', t1.date_expiry ) >'0'
ORDER BY date_added DESC LIMIT $from1, $max_results1
";

1 个答案:

答案 0 :(得分:0)

添加一个where子句并说不显示那些类别的项目。喜欢

 WHERE category!="blah"