linda in den i en underfråga (och skapa en tillfällig tabell )
UPDATE o_daily_lcsgeneration_copy
SET o_daily_lcsgeneration_copy.Billing_cycle =
(
SELECT Billing_cycle
FROM
(
SELECT s_billing_cycle.Billing_cycle
FROM s_billing_cycle
INNER JOIN o_daily_lcsgeneration_copy
ON o_daily_lcsgeneration_copy.Location = s_billing_cycle.Location
WHERE o_daily_lcsgeneration_copy.DATE BETWEEN s_billing_cycle.From_Date
AND s_billing_cycle.To_Date
) s
)
eller JOIN
tabellerna
UPDATE o_daily_lcsgeneration_copy a
INNER JOIN s_billing_cycle b
ON a.Location = b.Location
SET a.Billing_cycle = b.Billing_cycle
WHERE a.DATE BETWEEN b.From_Date AND b.To_Date