view_poinforec_mstr.sql

来自「工厂采购系统,DELPHI+SQL SERVER,三层技术」· SQL 代码 · 共 36 行

SQL
36
字号
delete from PO_Price_Mstr where item in
(select item from (select Min(Item) as Item,Vendor_ID,HPN,MOQ,MPQ  
from po_information_Record where isnull(hpn,'')<>''
group by  Vendor_ID,HPN,MOQ,MPQ
having count(HPN)>1) a)
go

delete from PO_information_Record where item in
(select item from (select Min(Item) as Item,Vendor_ID,HPN,MOQ,MPQ 
 from po_information_Record
where isnull(hpn,'')<>''
group by  Vendor_ID,HPN,MOQ,MPQ
having count(HPN)>1) a)

go
select Min(Item) as Item,Vendor_ID,HPN,MOQ,MPQ,Lead_Time  
  from po_information_Record where isnull(hpn,'')<>''
group by  Vendor_ID,HPN,MOQ,MPQ,Lead_Time
having count(HPN)>1


if object_id('dbo.Viw_POInfoRec_Mstr') is not null
drop view Viw_POInfoRec_Mstr
go

create view Viw_POInfoRec_Mstr
as
 select  Vendor_ID,HPN,MOQ,MPQ,Lead_Time  from PO_Information_Record
where isnull(hpn,'')<>'' and len(hpn)>5
group by Vendor_ID,HPN,MOQ,MPQ,Lead_Time 

go



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?