我做了两个Table
(Quotation1
和Quotation2
)并且它跟随Columns
喜欢:
CREATE TABLE Quotation1 (
Q_No INTEGER (10),
Date DATE,
C_Code VARCHAR (45),
C_Name VARCHAR (45),
C_Contact VARCHAR (45),
G_Tot VARCHAR (45),
Remarks VARCHAR (250)
);
CREATE TABLE Quotation2 (
Q_No VARCHAR (45),
P_Code VARCHAR (45),
P_Name VARCHAR (45),
Price VARCHAR (45),
Qnty INTEGER (10),
Amt VARCHAR (45),
Discount_Per INTEGER (10),
Discount INTEGER (10),
VAT_Per INTEGER (10),
VAT INTEGER (10),
Tot_Amt VARCHAR (45)
);
我必须Joins
Table
并Result
Third Table
Quotation
Columns
其中CREATE TABLE Quotation (
Q_No INT (10) PRIMARY KEY
NOT NULL,
Date DATE,
C_Code VARCHAR (45) REFERENCES CustomerInfo (C_Code) ON DELETE NO ACTION
ON UPDATE NO ACTION
MATCH SIMPLE NOT DEFERRABLE INITIALLY DEFERRED,
C_Name VARCHAR (45),
C_Contact VARCHAR (45),
Remarks VARCHAR (45),
P_Code VARCHAR (45) REFERENCES ProductInfo (P_Code) ON DELETE NO ACTION
ON UPDATE NO ACTION
MATCH SIMPLE NOT DEFERRABLE INITIALLY DEFERRED,
P_Name VARCHAR (45),
Price VARCHAR (45),
Qnty INTEGER (10),
Amount VARCHAR (45),
Discount_Per INTEGER (10),
Discount INTEGER (10),
VAT_Per INTEGER (10),
VAT INTEGER (10),
Tot_Amt VARCHAR (45),
G_Tot VARCHAR (45)
)
WITHOUT ROWID;
赞成:{/ 1} >
Query
我已申请跟随INSERT INTO Quotation (Q_No,Date,C_Code,C_Name,C_Contact,Remarks,P_Code,P_Name,Price,Qnty,Amount,Discount_Per,Discount,VAT_Per,VAT,Tot_Amt,G_Tot)
SELECT Quotation2.Q_No,
Quotation1.Date,
Quotation1.C_Code,
Quotation1.C_Name,
Quotation1.C_Contact,
Quotation1.Remarks,
Quotation2.P_Code,
Quotation2.P_Name,
Quotation2.Price,
Quotation2.Qnty,
Quotation2.Amt,
Quotation2.Discount_Per,
Quotation2.Discount,
Quotation2.VAT_Per,
Quotation2.VAT,
Quotation2.Tot_Amt,
Quotation1.G_Tot
FROM Quotation1,
Quotation2
INNER JOIN Quotation ON Quotation1.Q_No=Quotation2.Q_No;
赞:
Result
它提供了以下[02:16:23] Query finished in 0.010 second(s).
赞:Data
但是不显示任何Column Name
不均匀"?prefilter=1"
请帮助。
答案 0 :(得分:0)
插入时为什么要加入目标表?
-- Insert
INSERT INTO Quotation (Q_No,Date,C_Code,C_Name,C_Contact,Remarks,P_Code,P_Name,Price,Qnty,Amount,Discount_Per,Discount,VAT_Per,VAT,Tot_Amt,G_Tot)
SELECT Quotation2.Q_No,
Quotation1.Date,
Quotation1.C_Code,
Quotation1.C_Name,
Quotation1.C_Contact,
Quotation1.Remarks,
Quotation2.P_Code,
Quotation2.P_Name,
Quotation2.Price,
Quotation2.Qnty,
Quotation2.Amt,
Quotation2.Discount_Per,
Quotation2.Discount,
Quotation2.VAT_Per,
Quotation2.VAT,
Quotation2.Tot_Amt,
Quotation1.G_Tot
FROM Quotation1
JOIN Quotation2 ON Quotation1.Q_No = Quotation2.Q_No;
-- Show results:
SELECT * FROM Quotation;
应该做的工作。