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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.