0

私はこのテーブルを持っています。

  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

このテーブルにもう 1 列追加したい

お気に入り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; 
4

1 に答える 1

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 
于 2013-03-22T05:46:14.347 に答える