sql总结

上一篇 / 下一篇  2013-04-02 09:26:44 / 个人分类:sql

---select 字段 from 表名 a

inner join 表名  b on b.字段=a.字段

inner join 表名 c on c.字段=b.字段/a.字段

Select B.PKID As FK_Dealer, D.FK_SDDealer,Price.FK_Product
from SOI_BPCSDealerInfo B
Inner Join SOI_SDDealerDetails D On B.PKID = D.Fk_BPCSDealerinfo
Inner Join UT_DealerNetPrice Price On Price.FK_Dealer = B.PKID
Inner Join UT_Product P ON Price.FK_Product = P.PKID
Where B.Isvalid = 1 And D.Isvalid = 1 And P.Isvalid = 1 And Price.Isvalid = 1
And B.BPCSCode = '640026'

----in查询

Select * From DMS_Users
where FK_Dealer In (
Select FK_SDDealer From SOI_SDDealerDetails Where FK_BPCSDealerInfo =(
Select PKID From SOI_BPCSDealerInfo Where BPCSCode='640026'  And IsValid=1) And IsValid=1
) And Isvalid=1

-----in删除

FK_SOI_WSL_SellTargetRatioMaster与soi_wsl_selltargetratiomaster的pkid关联

Delete From SOI_WSL_SellTargetRatioDetail Where
FK_SOI_WSL_SellTargetRatioMaster In
(
 select PKID from SOI_WSL_SellTargetRatioMaster where fk_dealer = 738

---排序

select * from SOI_WSL_FCSTApproval  order by approvaltime desc

 


TAG:

 

评分:0

我来说两句

日历

« 2022-01-24  
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

数据统计

  • 访问量: 1744
  • 日志数: 13
  • 书签数: 1
  • 建立时间: 2011-11-28
  • 更新时间: 2013-06-13

RSS订阅

Open Toolbar