Answer the question
In order to leave comments, you need to log in
How to optimize database query?
->addFrom("LEFT JOIN `betaintranet`.`ad_c`","`tgb`","`node`.`nid` = `tgb`.`obj_id` AND `tgb`.`start_date`<= NOW() AND `tgb`.`end_date` >= NOW() AND `tgb`.`ban_type` < '4' /* vrezka */")
->addField("COUNT(DISTINCT `tgb`.`bid`)","`tgbactiv`")
->addField("`tgb`.`bid`","`tgbid`")
->addField("`tgb`.`phone`","`tgbphonebaze`")
->addFrom("LEFT JOIN `betaintranet`.`ad_banners`","`tgbinfo`","`tgb`.`bid` = `tgbinfo`.`bid`")
->addField("`tgbinfo`.`filename`","`tgbimageurl`")
->addField("`tgbinfo`.`url`","`tgburl`")
->addField("`tgbinfo`.`text`","`tgbtext`")
->addField("`tgbinfo`.`footer`","`tgbprice`")
->addField("`tgbinfo`.`header_text`","`tgbtitle`")
< 4
. Answer the question
In order to leave comments, you need to log in
NOW() NOT BETWEEN `tgb`.`start_date` AND `tgb`.`end_date`
`tgb`.`start_date`<= NOW() AND `tgb`.`end_date` >= NOW() AND `tgb`.`ban_type` < '4'
in WHERE.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question