i have the following two statements and want to get this in only one statement. Is that possible?
Statement One, getting Content from the last 2 Days:
SELECT
c.ID SUBTAG
FROM
`content` c,
posts p
WHERE
c.id = p.id_content AND
from_unixtime(p.scheduled) BETWEEN TIMESTAMPADD(DAY,-2,now()) AND from_unixtime(UNIX_TIMESTAMP(NOW()))
ORDER BY from_unixtime(p.scheduled)
With c.id i need to get sum(qty) from Orders. Like that:
SELECT
sum(Qty) Bestellungen,
SUBTAG
FROM
Orders
WHERE SubTag Like '%c.id%'
GROUP BY SubTag
Within the table orders the Column Subtag doesnt exactly has the c.id. Its just part of the Column. That's why i need the like! Subtag in Table Orders looks like 132_subtag_kjsdf4382.
Table Orders looks like:
Date_ Price Qty SubTag
2017-02-20 14.98 1 b1a8cc_2_qgsGairwtape
2017-02-20 14.98 1 b1a8cc_3_qgdfgdirwtape
posts look like:
ID id_content scheduled ad_active posted
3015 82 1487754540 0 1
And content looks like:
ascsubid ID
b1a8cc 82
Result from the query should look like:
SubTag Orders
b1a8cc 2