我有一个完美的数据库查询;
SELECT
campaigns.cid, campaigns.aid, campaigns.weburl, CampCount
FROM
campaigns
LEFT JOIN
(SELECT
adtracking.cid, count(*) AS CampCount
FROM adtracking
WHERE adtracking.createdate = [todays date]
GROUP BY adtracking.cid ) AS adtracking ON campaigns.cid = adtracking.cid
WHERE
campaigns.catid = '1'
AND campaigns.campaigncomplete = '0'
AND campaigns.active = '1'
AND (adtracking.cid IS NULL OR CampCount < campaigns.dailynumberofimpressions)
ORDER BY
RAND()
LIMIT 1
首先,广告表是一个到多个广告系列。因此它适用于许多广告系列的广告客户。 aid是广告客户ID,是广告系列表的链接。 cid是广告系列ID。
一个新字段刚刚放入名为adminstop的advertiseter表中,它的值可以是&#34; 0&#34;为假和&#34; 1&#34;真的。如果此条款为真,则此援助的所有广告系列将不再运行。
所以我试图加入查询
where campaign.cid in (select cid from advertisers where aid.adminstop = '0')
我没有任何运气。任何帮助,将不胜感激。 谢谢,
杰夫戈德斯坦