-3

I am trying to copy a few fields of video information from one MariaDB table to another using a subquery, decoupling some video info from a classified ads table for later refactoring.

video:

id (int 11 autoincrement)
video_source (varchar 50)
video_url (varchar 255)
user_id(int 11)

I copy two fields:

INSERT INTO videos (video_url,user_id)
VALUES (SELECT youtube_url as video_url, user_id
    FROM ads WHERE ads.youtube_url!="") 

The subquery works on its own, but the insert query gives me an error 1046 and the cryptic message that I have an error in my subquery.

What are issues with the auto increment field in the video table?

What is wrong with my query?

3

1 Answer 1

1

Use the proper version of INSERT:

INSERT INTO videos (video_url,user_id) 
  SELECT youtube_url, user_id 
     FROM ads WHERE youtube_url!=''; 
Sign up to request clarification or add additional context in comments.

2 Comments

Whatever 1 question this post is trying to ask is clearly a trivially found faq that is not usefully asked or answered yet another time.
Apologies for all the commotion apparently, this is my first stack overflow post, thank you philipxy for providing me with the solution.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.