Projecten

Array
(
    [afmeting] => 300 x 250
    [aantal] => 1
    [term_ids] => 29
    [homepagina] => 0
    [magazine] => 0
    [bedrijf_ids] => 0
)
  SELECT
                    sub.`id`,
                    sub.`naam`,
                    sub.`afmeting`,
                    sub.`url`,
                    sub.`attachment_id`,
                    sub.`banner_url`,
                    sub.`type`
                FROM
                (
                    SELECT
                        b.`id`,
                        b.`bedrijf_id`,
                        b.`naam`,
                        b.`afmeting`,
                        b.`url`,
                        b.`attachment_id`,
                        b.`banner_url`,
                        b.`type`
                    FROM
                        `sb_banners` b
                    LEFT JOIN `sb_postmeta` pm ON pm.`post_id` = b.`bedrijf_id` AND pm.`meta_key` = 'einddatum_contract' LEFT JOIN `sb_postmeta` pm2 ON pm2.`post_id` = b.`bedrijf_id` AND pm2.`meta_key` = 'banner_bij_onderwerpen'WHERE
                        b.`afmeting` = '300 x 250' AND
                        b.`actief` = 1 AND
                        b.`louwers_goedgekeurd` = 1 AND
                        pm.`meta_value` > '20180920' AND (pm2.`meta_value` LIKE '%29%') ) as sub
                GROUP BY sub.`bedrijf_id`
                ORDER BY rand()
                LIMIT 1
Array
(
    [afmeting] => 300 x 250
    [aantal] => 1
    [term_ids] => 58
    [homepagina] => 0
    [magazine] => 0
    [bedrijf_ids] => 0
)
  SELECT
                    sub.`id`,
                    sub.`naam`,
                    sub.`afmeting`,
                    sub.`url`,
                    sub.`attachment_id`,
                    sub.`banner_url`,
                    sub.`type`
                FROM
                (
                    SELECT
                        b.`id`,
                        b.`bedrijf_id`,
                        b.`naam`,
                        b.`afmeting`,
                        b.`url`,
                        b.`attachment_id`,
                        b.`banner_url`,
                        b.`type`
                    FROM
                        `sb_banners` b
                    LEFT JOIN `sb_postmeta` pm ON pm.`post_id` = b.`bedrijf_id` AND pm.`meta_key` = 'einddatum_contract' LEFT JOIN `sb_postmeta` pm2 ON pm2.`post_id` = b.`bedrijf_id` AND pm2.`meta_key` = 'banner_bij_onderwerpen'WHERE
                        b.`afmeting` = '300 x 250' AND
                        b.`actief` = 1 AND
                        b.`louwers_goedgekeurd` = 1 AND
                        pm.`meta_value` > '20180920' AND (pm2.`meta_value` LIKE '%58%') ) as sub
                GROUP BY sub.`bedrijf_id`
                ORDER BY rand()
                LIMIT 1