0

I am being thrown a really weird error code, judging that I have successfully INSERTed values using the same query in a similar schema.

I am trying to execute the following query:

INSERT INTO part_approval (part_quote_key)
SELECT part_quote_key
FROM database.part_quote;

The part_approval table is empty and columns are either NULLable or have DEFAULT values. The part_quote table looks like this:

part_quote_key  price      batch       part_key   quote_key
1               12.90      30          5          17        2014-06-03 15:53:18
2               22.87      15          8          17        2014-06-03 16:14:52
3               19.96      15          9          17        2014-06-03 15:53:18
4               24.52      15          10         17        2014-06-03 15:53:18
5               13.65      15          14         17        2014-06-03 16:14:52

The error details point to "Column part_key is ambiguous in field list". However, the part_key column is not even in my result list of the above SELECT statement.

In addition, I've used the following statement to populate a similar table and it worked:

INSERT INTO component_approval (component_quote_key)
SELECT component_quote_key
FROM database.component_quote;

Is there anything I am overlooking?

Thanks for all your help in advance, Marius

mmmarius
  • 15
  • 3
  • Did you try running the 2 queries separately? Like just the select statement, and then insert with any random number. – Nawed Khan Jun 03 '14 at 16:50

1 Answers1

0

Please try running your query by qualifying the columns by prefixing the table name or alias.

Refer this simmilar question: 1052: Column 'id' in field list is ambiguous

Community
  • 1
  • 1
user3182536
  • 128
  • 1
  • 12