首页 新闻 搜索 专区 学院

大神们请教linq、lambda的问题,这样的sql如何写用linq或者lambda语法写?

0
[待解决问题]
SELECT TOP 500
    Logis_fahuoHeader.ID,
    .....    
    Logis_fahuoHeader.DriverTel,
    Logis_fahuoHeader.SystemNOs,
    Logis_fahuoHeader.HasPeisongshang,
    Logis_fahuoHeader.HasChengyunshang,
    Logis_fahuoHeader.shouhuoren,   
    CASE
        WHEN fanhuitupian IS NULL THEN
            ''
        ELSE
            ''
    END AS shifoushangchuanqiandan,
    (
        SELECT MyName FROM Basic_chengyunshang WHERE ID = CooperateIDchengyunshang
    ) AS chengyunshang,
    (
        SELECT MyName FROM Basic_chengyunshang WHERE ID = CooperateIDpeisongshang
    ) AS peisongshang
FROM Logis_fahuoHeader
WHERE 1 = 1
      AND IsTemp = 0
SELECT Logis_shouhuoHeader.*,
    (
        SELECT TOP 1
            myname
        FROM dbo.Basic_chengyunshang
        WHERE ID = CooperateIDchengyunshang
    ) AS chengyunshang,
    (
        SELECT TOP 1
            myname
        FROM dbo.Basic_chengyunshang
        WHERE ID = CooperateIDpeisongshang
    ) AS peisongshang
FROM dbo.Logis_shouhuoHeader,
    dbo.Logis_fahuoHeader,
    dbo.Logis_fahuoDetail
WHERE Logis_shouhuoHeader.ID = Logis_fahuoDetail.shouhuoHeaderID
      AND Logis_fahuoDetail.HeaderID = Logis_fahuoHeader.ID
      AND Logis_shouhuoHeader.DateTihuo >= '2017-05-01 00:00:00'
      AND Logis_shouhuoHeader.DateTihuo <= '2017-05-01 23:59:59'
      AND CooperateIDpeisongshang IN
          (
              SELECT ID FROM dbo.Basic_chengyunshang WHERE MyName = 'xiaowang'
          );

如上两段sql 如何用linq或者lambda写

木头园—OOIP的主页 木头园—OOIP | 菜鸟二级 | 园豆:212
提问于:2017-05-01 08:34
< >
分享
所有回答(1)
0

有人吗😳

木头园—OOIP | 园豆:212 (菜鸟二级) | 2017-05-01 21:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册