SELECT b.*
FROM
cms_module_banners_in_category_manager bc,
cms_module_banners b
WHERE
bc.cat_id = 15 and
bc.status = 'active' and
(
bc.max_impressions = 0 or
bc.max_impressions > (
select sum(impressions)
from cms_module_banners_hits_and_impressions bhi
where
bhi.cat_id = 15 and
bhi.banner_id = bc.banner_id
)
) and
(
bc.never_expire = 1 or
(
(
bc.from_date = '0000-00-00' and bc.to_date = '0000-00-00'
) or
(
bc.from_date != '0000-00-00' and bc.to_date = '0000-00-00' and bc.from_date <= curdate()
) or
(
bc.from_date = '0000-00-00' and bc.to_date != '0000-00-00' and bc.to_date >= curdate()
) or
(
curdate() between bc.from_date and bc.to_date
)
)
) and
bc.banner_id = b.banner_id
ORDER BY RAND() LIMIT 0,1
Error!
No banners matched the query
SELECT b.*
FROM
cms_module_banners_in_category_manager bc,
cms_module_banners b
WHERE
bc.cat_id = 16 and
bc.status = 'active' and
(
bc.max_impressions = 0 or
bc.max_impressions > (
select sum(impressions)
from cms_module_banners_hits_and_impressions bhi
where
bhi.cat_id = 16 and
bhi.banner_id = bc.banner_id
)
) and
(
bc.never_expire = 1 or
(
(
bc.from_date = '0000-00-00' and bc.to_date = '0000-00-00'
) or
(
bc.from_date != '0000-00-00' and bc.to_date = '0000-00-00' and bc.from_date <= curdate()
) or
(
bc.from_date = '0000-00-00' and bc.to_date != '0000-00-00' and bc.to_date >= curdate()
) or
(
curdate() between bc.from_date and bc.to_date
)
)
) and
bc.banner_id = b.banner_id
ORDER BY RAND() LIMIT 0,1
Error!
No banners matched the query
SELECT b.*
FROM
cms_module_banners_in_category_manager bc,
cms_module_banners b
WHERE
bc.cat_id = 17 and
bc.status = 'active' and
(
bc.max_impressions = 0 or
bc.max_impressions > (
select sum(impressions)
from cms_module_banners_hits_and_impressions bhi
where
bhi.cat_id = 17 and
bhi.banner_id = bc.banner_id
)
) and
(
bc.never_expire = 1 or
(
(
bc.from_date = '0000-00-00' and bc.to_date = '0000-00-00'
) or
(
bc.from_date != '0000-00-00' and bc.to_date = '0000-00-00' and bc.from_date <= curdate()
) or
(
bc.from_date = '0000-00-00' and bc.to_date != '0000-00-00' and bc.to_date >= curdate()
) or
(
curdate() between bc.from_date and bc.to_date
)
)
) and
bc.banner_id = b.banner_id
ORDER BY RAND() LIMIT 0,1