mysql - 如何在 mysql,vb.net 中将不同字段从一个表插入到另一个表

标签 mysql vb.net

INSERT INTO invoice
SELECT invoiceid, customerid
FROM accountinginvoice where invoiceid='0380'

我尝试了这个,但是发生了错误

Column count doesn't match value count at row 1

请帮助我。我在两个表中有很多不同的列和大量数据

最佳答案

/*
Here we got 2 tables, Table1 and Table2.
we are selecting Table1.userName and Table2.Userid into a new BackupData Table.
The folloiwing is a straight forward query and i hope this helps.
*/

SELECT Table1.UserName, Table2.UserID
INTO BackupData
FROM Table1
LEFT JOIN Table2
ON Table1.UserID=Table2.UserID;

关于mysql - 如何在 mysql,vb.net 中将不同字段从一个表插入到另一个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28711193/

相关文章:

c# - 这个 C# 简写代码片段的 VB 等价物

Mysql行返回/最新记录中的错误值

php - 从 Facebook 登录中提取名称和 ID 字符串?

vb.net - 将 MIME 编码的附件发布到 Ariba Supply Network 时出现问题

sql-server - SQL Server 2005 数据类型和 VB.NET

c# - 下载的 dll 中显示错误

mysql - 如何将 MS-SQL Server SELECT 查询转换/迁移到 Oracle 和 MySQL?

mysql - 日期之间的 CASE 语句

mysql - 抛出“不是数组引用”错误

.net - DLL 中未调用 VB.NET 静态构造函数