我有这张桌子。
orderid processid uid user processdesc companyname ordervalue perwet orgid
1 1 16 Damayanti Enquiry Synechron 33000 10.00 NULL
1 2 4 Meghana Requirement Synechron 33000 10.00 NULL
1 3 5 Yogini Proposal FollowUp Synechron 33000 10.00 NULL
1 4 5 Yogini Order Synechron 33000 20.00 NULL
1 5 4 Meghana Vendor Management Synechron 33000 10.00 NULL
1 6 1 anaghantech Collection Synechron 33000 20.00 NULL
2 1 4 Meghana Enquiry test 100000 10.00 NULL
2 2 4 Meghana Requirement test 100000 10.00 NULL
2 3 5 Yogini Proposal FollowUp test 100000 10.00 NULL
2 4 4 Meghana Order test 100000 20.00 NULL
2 5 4 Meghana Vendor Management test 100000 10.00 NULL
2 6 1 anaghantech Collection test 100000 6.67 NULL
2 6 4 Meghana Collection test 100000 6.67 NULL
2 6 16 Damayanti Collection test 100000 6.67 NULL
5 1 16 Damayanti Enquiry FASTER HYDRAULICS PVT. LTD. 700000 10.00 NULL
5 2 16 Damayanti Requirement FASTER HYDRAULICS PVT. LTD. 700000 10.00 NULL
5 3 16 Damayanti Proposal FollowUp FASTER HYDRAULICS PVT. LTD. 700000 10.00 NULL
5 4 16 Damayanti Order FASTER HYDRAULICS PVT. LTD. 700000 20.00 NULL
我想在此表中添加一列
喜欢perwet/100 * ordervalue
使用下面给出的查询
SELECT a.orderid,
b.processid,
b.uid,
d.username,
c.processdesc,
a.companyname,
b.ordervalue,
b.perwet,
b.orgid
FROM ordermaster a,
temp_calpoints1 b,
process c,
userinfo d
WHERE a.orderid = b.orderid
AND c.processid = b.processid
AND d.uid = b.uid
ORDER BY b.orderid,
b.processid,
b.uid;
答案 0 :(得分:0)
您可以使用VIEW而不是在表格中添加新列:
CREATE VIEW dbo.MyView
AS
SELECT a.orderid,
b.processid,
b.uid,
d.username,
c.processdesc,
a.companyname,
b.ordervalue,
b.perwet,
b.orgid,
MyField = b.perwet / 100 * b.ordervalue
FROM ordermaster a,
temp_calpoints1 b,
process c,
userinfo d
WHERE a.orderid = b.orderid
AND c.processid = b.processid
AND d.uid = b.uid