Jump to content

[SOLVED] INSERT INTO from a table with 3 colums into one with 4, marking the 4th as true?


Axeia

Recommended Posts

I got 2 tables with near identical values, the first 3 fields are an exact match. The fourth (downloaded) is a boolean which is unique to the Checked table.

Now I want move an entry from Downloads to Checked, do I really have to use 3 queries for this action?

1) INSERT INTO

2) Update the just inserted value to set downloaded to true

3) Remove entry from Downloads table.

 

Seems odd to me, I thought something like the example below (which doesn't work) would be able to combine step 1 and 2.

INSERT INTO Checked(date,filename,download,downloaded)
SELECT  date,filename,download,true
FROM Downloads
WHERE Downloads.download = :filename

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.