从多个表结果创建或更新记录

时间:2018-06-17 13:13:28

标签: mysql

在会计中,我们必须通常为供应商,客户或员工创建发票或日记帐分录。当用户从下拉框中选择其中一个时,创建/更新语句是什么样的,以确保您写入正确的表?

MySQL 5.7

create table tblVendors (
VendorID int,
name varchar(255));

create table tblCustomers (
CustomerID int,
name varchar(255));

create table tblEmployees (
EmployeeID int,
name varchar(255));

insert into tblVendors VALUES (1001, "Vendor1001");
insert into tblCustomers Values (2001, "Customer2001");
insert into tblEmployees VALUES (3001, "Employee3001");

--Drop Down Menu Select Statement
    SELECT * FROM tblVendors t1 Union select * from tblCustomers t2 union select * from tblEmployees t3;

0 个答案:

没有答案