Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7628731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:39:02+00:00 2026-05-31T05:39:02+00:00

This might be hard to understand so let me know if I need to

  • 0

This might be hard to understand so let me know if I need to describe it better. Say I have 3 tables tableA, tableB, and tableC with the following syntax:

CREATE TABLE tableA (
    data_point_1 VARCHAR(30),
    data_point_2 VARCHAR(30),
    data_point_3 VARCHAR(30)
);

CREATE TABLE tableB (
    bid INTEGER AUTO_INCREMENT,
    cid INTEGER AUTO_INCREMENT,
    data_point_1 VARCHAR(30),
);

CREATE TABLE tableC (
    cid INTEGER AUTO_INCREMENT,
    data_point_2 VARCHAR(30),
    data_point_3 VARCHAR(30)
);

Now what I want to do is transfer the data from tableA into tableB and tableC. So in essence I want something like:

INSERT INTO tableB
SELECT
    data_point_1,
    (SELECT cid FROM tableC WHERE (INSERT INTO tableC SELECT data_point_2, data_point_3 FROM tableA))
FROM tableA

I haven’t tried the above, but I’m assuming it is not possible since INSERT doesn’t return the actual values (I would need a select I assume), but my question becomes how can I insert data from A put it into C and then at the same time grab the id from C and another data point from A and place those both into B.

I figure I can probably break it up into 2 insert statements and then do a select on C where data_point_2 = data_point_2 and data_point_3=data_point_3, but I was wondering if there was a way to do it in just one query? I couldn’t find anything so I figured I’d ask here.

Again: I don’t want 2 separate insert queries. I want to be able to do it in 1. (Cause theoretically I might need to abstract it further)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:39:03+00:00Added an answer on May 31, 2026 at 5:39 am

    The solution looks to be that there is no solution =/ guess i’ll have to do it in multiple inserts. Thanks for all the help everyone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this might sound silly but I am finding it hard to understand
I realise this might be hard to explain, so let me start by using
This might be hard to describe in the title, here's a sample data: id
This might be a simple question for some people since it was quite hard
Hopefully this one is not too hard to understand but I just want the
I know that this question has been asked loads of times, but I have
I am having a hard time following this function. I do not understand how
The question might be slightly hard to understand, so I'll explain it more verbosely:
This might be a really trivial one. Is File storage OS dependant ? Why
This might be the most stupid thing i've ever seen, i had a broken

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.