MySQL Forums
Forum List  »  MySQL Shell

SQL Query gives result but when inserted to a table it fails [duplicate]
Posted by: Vishal Lavti
Date: June 27, 2021 07:29AM

I have a strange problem and need help/explanation and workaround.

SELECT
SUM(value)
FROM
account a,
colorCarrier p
WHERE
a.accountid= p.id
GROUP BY m1here
In original tables, accountid is varchar and id is bigint. The value column is double and amount column in tempTable is also double.

The above query returns the result fine but when I try to insert the data in a table, it fails with Error Code: 1292. Truncated incorrect DOUBLE value

insert into tempTable (amount)
SELECT
SUM(value)
FROM
account a,
colorCarrier p
WHERE
a.accountid= p.id
GROUP BY m1
What I am not able to understand is why does it have problem only when the data is inserted into table? Why the query returns the results fine when executed seperately? What can I do to resolve this issue?

The above query is being generated dynamically so I can't use cursor either.

Options: ReplyQuote


Subject
Views
Written By
Posted
SQL Query gives result but when inserted to a table it fails [duplicate]
259
June 27, 2021 07:29AM


Sorry, only registered users may post in this forum.

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.