"SELECT
FROM_UNIXTIME(w.createdAt, '%Y-%m-%d') AS createdAt,
sum(w.tg_yongjin) as tg_yongjin,
w.id,
c.contact AS tj_contact,
c.shopName AS tj_shopName,
c.tel AS tj_tel,
c.anotherName AS tj_anotherName,
d.contactPhone,
d.fyMchntCd
FROM
dtg_order_wlw w
LEFT JOIN dtg_shop s ON w.shopId = s.id
LEFT JOIN dtg_vendor v ON v.mobile = s.tel
LEFT JOIN (
SELECT
o.shopName,
o.tel,
o.contact,
o.anotherName
FROM
dtg_shop o
) c ON v.tj_mobile = c.tel
LEFT JOIN (
SELECT
e.fyMchntCd,
e.id,
e.contactPhone
FROM
dtg_fy_vendor e
) d ON v.tj_mobile = d.contactPhone
WHERE
".$conditions."
GROUP BY
tj_tel
ORDER BY
w.createdAt DESC";