• SQL 实战语句(9)


    1.如何同步根据部门表同步另外一个项目表的部门字段

    update A set A.auditownerid=(select lp.epleaderId
    from (select ep.userid as epuserid,adp.leaderId as epleaderId from B ep left join DP adp
    on adp.arcid=ep.departmentid) lp where A.ownerid=lp.epuserid)

    2.同步一列数据等于另一列数据

    update [dbo].[InvoiceTab] set ActualInvoiceMoney=InvoiceMoneyAmount  where invoicestatus=6  and  isdeleted=0

    3.根据一列表中数据,同步生成另一个表数据

    insert into [dbo].[InvoiceTabDetails]
    select newid(),invoiceId,projectId,ownerid,invoicenumber,invoiceMoneyAmount,ownerid,UpdateOperatorId,'',1,0,invoiceRaiseDate
    ,actualPayDate,actualPayDate,PayMoney,invoiceRaiseDate
    from (select ic.invoiceId,ic.projectId,ic.invoicenumber,pro.ownerid,ic.invoiceRaiseDate,ic.actualPayDate,
    ic.invoiceMoneyAmount,ic.PayMoney,ic.isdeleted,ic.updatetime,ic.UpdateOperatorId
    from invoicetab ic left join projecttab pro on ic.projectid = pro.projectid
    where ic.invoicestatus=6 and ic.actualPayDate is not null and ic.isdeleted=0 ) InvocieData

     4.添加字段-修改字段名称-删除约束和字段

    1.ALTER TABLE  DailyWorkServiceDetail ADD DifferenceProportion  float  default 0.0  not null 

    2.sp_rename 'DailyWorkServiceSummary.AllProjecMoney','AllProjectMoney'

    3.alter table DailyWorkServiceSummary drop column ProjecStatisticData

       alter table ProjectPhone drop constraint DF__ProjectPh__Diffe__03A67F89

  • 相关阅读:
    Codeforces Round #124 (Div. 2)
    Codeforces Round #158 (Div. 2)
    Codeforces round FF
    缕缕,
    拉伸 原来 就这一句话,
    tableveiw上面 的手势,
    reloaddata 是没有对 tableview的 headerview进行 刷新的,
    y
    考虑欠缺 以及 设计 导致的 工作量,
    present出来的 controller上的 controller里面用 navigationcontrolle了,失效了,
  • 原文地址:https://www.cnblogs.com/hanxingli/p/10316263.html
Copyright © 2020-2023  润新知