sql - 如何将信息插入到 SQL 中同一记录的不同列中?
问题描述
我想使用 VBA 在表中创建一条记录,并添加与不同列中的记录有关的不同信息。
目前,我的代码创建了一条新记录并为其命名。现在在同一条记录下,我想添加一个地址。如何才能做到这一点?
在这里,我的代码将值“Testing VB”插入到表 customer 中的 Name 中。如何向同一客户添加地址?
sSQL = "Insert into customer (Name) values ('Testing VB')"
解决方案
如果你想同时插入
Insert into customer (Name, Address) values ('Testing VB', 'My address')
如果要在执行插入后添加,则需要更新
update customer
set address = 'My Addres'
where Name = 'Testing VB'
推荐阅读
- javascript - handle multiselect case on selecting and deselecting button/component
- swift - SwiftUI 中带有自定义绑定的可选扩展
- postgresql - 创建一个带有括号的列名的表
- jvm - Java字节码,调用方法不能正常工作
- powerbi - Power BI 自定义视图(与 tableu 类似)
- python - 我应该使用 OAuth2 身份验证吗?
- mysql - 对于这些约束,合适的表/数据库设计是什么?
- sql-server - 用其他表触发函数,但不是这个表。消息 102
- snowflake-cloud-data-platform - 将雪花运行时错误发送到 Amazon Notification Service(SNS)
- java - 在 Java 应用程序中处理用户配置的最佳方式是什么?