MySQL Forums
Forum List  »  New in 4.1: Subqueries

Problem with Nested Inserts
Posted by: Juan Javaloyes
Date: July 26, 2005 04:23PM

This is my problem. I have two tables (let's called "a" and "b"). I need to load all the columns (specifically, 15.000) "a4", "a5" and "a6" from "a" with data from columns "b3", "b6" and "b7" from "b" (being same datatype), where "acode" (on "a") = "bcode" (on "b"). I did this (the closest solution I tried, at least):

insert into a (a4, a5, a6)
select b3, b6, b7
from b
where bcode = (select acode from a)

The error says "Subquery returns more than 1 row"

I must say all columns on "a" (except those I want to be loaded) are already loaded with data, included (of course!) "acode"
I know this may had a simple solution, but I tried everything, may I be just tired?

Options: ReplyQuote


Subject
Views
Written By
Posted
Problem with Nested Inserts
6246
July 26, 2005 04:23PM
3442
July 26, 2005 06:59PM
3069
July 27, 2005 12:23PM
3736
July 27, 2005 01:21PM
3343
July 27, 2005 02:11PM
3287
July 27, 2005 03:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.