Poiché stai selezionando da una tabella, vorrai utilizzare un INSERT INTO SELECT FROM
domanda:
INSERT INTO campaign_ledger
(
`campaign_id`
, `description`
, amount
, balance
, timestamp
)
SELECT
id as campaign_id
, 'Ported from campaigns' as description
, budget_remaining as amount
, budget_remaining as balance
, NOW() as timestamp
FROM campaigns
Usa solo INSERT INTO VALUES
quando si utilizzano valori specifici e non si seleziona da una tabella. Se desideri utilizzare INSERT INTO VALUES
allora la tua domanda sarebbe questa:
INSERT INTO campaign_ledger
(
`campaign_id`
, `description`
, amount
, balance
, timestamp
)
VALUES
(
1
, 'test'
, 100.00
, 1000.00
, NOW()
)