• SQL补充查询


    SELECT  *
    FROM    (
                        SELECT ll.* ,ROW_NUMBER() OVER ( ORDER BY ll.New DESC,ll.EditTime ) AS RID FROM (
                        SELECT     c.* ,
                                    ct.TypeName AS ''CaseType'' ,
                                    cr.TypeName AS ''ReasonType'',
    CASE WHEN
    (SELECT MAX(IsLatest) FROM B_Exchange_TB WHERE CaseID = C.CaseID)=2 THEN 1
    WHEN (
     SELECT COUNT(1) FROM
      (SELECT ExchangeID FROM B_ExchangeAnswer_TB WHERE ShowNew=2 AND AnswerType=2) EA
     INNER JOIN
      (SELECT * FROM B_Exchange_TB)
      E ON E.ExchangeID=EA.ExchangeID WHERE E.CaseID=c.CaseID
    )>0 THEN 1
    ELSE 0
    END AS New
                          FROM      ( SELECT   C.*
                FROM     B_Case_TB C
                WHERE    ( SELECT    COUNT(1)
                  FROM     (SELECT  *  FROM      B_Exchange_TB ET WHERE CaseID=C.CaseID) E
                   INNER JOIN ( SELECT *
                       FROM   dbo.R_ExchSelTeacher_TB '
                + @WhereUser
                + '
                        ) EST ON EST.ExchangeID = E.ExchangeID
                  WHERE     E.CaseID = C.CaseID
                ) > 0 AND DelFlag = 0 '
                + @WhereCase + '
            ) c
                                   
                                    INNER JOIN ( SELECT LevelTypeID ,
                                                        CaseTypeID
                                                 FROM   dbo.R_LevelType_TB  '
                + @WhereLevelType
                + '
               ) lt ON c.LevelTypeID = lt.LevelTypeID
                                    INNER JOIN ( SELECT CaseTypeID ,
                                                        TypeName
                                                 FROM   dbo.D_CaseType_TB
                                               ) ct ON ct.CaseTypeID = lt.CaseTypeID
                                    INNER JOIN ( SELECT ReasonID ,
                                                        TypeName
                                                 FROM   D_CaseReason_TB '
                + @WhereReason + '
          ) cr ON cr.ReasonID = c.ReasonID )ll
            ) l
    WHERE   RID BETWEEN ' + CAST(@startNum AS VARCHAR) + ' AND '
                + CAST(@EndNum AS VARCHAR) 
            EXEC sp_executesql @Sql

     <style type="text/css">
        .newflag0{ display:none;}
        .newflag1{ color:red;}
    </style>

     <ItemTemplate>
                    <tr>
                    <td>
                        <asp:LinkButton ID="lnkshowAnswer" runat="server" CommandName="showAnswers" CommandArgument='<%# Eval("ExchangeID") %>' Text='<%# Eval("QuesTitle")%>'></asp:LinkButton>&nbsp;&nbsp;&nbsp;
                        <asp:Label ID="lblNew" runat="server" Visible="false" Text="New!" ForeColor="Red"></asp:Label>
                        <span class="newflag<%# Eval("[\"New\"]")%>"><sub>new!</sub></span>
                       
                        <asp:HiddenField ID="hfAddUserID" runat="server" Value='<%# Eval("AddUserID") %>' />
                    </td>
                    <td>
                        <%# Eval("LoginUserName")%>
                    </td>
                    <td>
                        <%# Eval("AddTime")%>
                    </td>
                </tr>
                   </ItemTemplate>
            </asp:Repeater>

  • 相关阅读:
    在桌面创建robotframework Ride的快捷方式启动RIDE
    RIDE 接口自动化请求体参数中文时报错:“UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 9......”
    下拉框选择
    Python下安装MySQLdb模块
    出现 Request Entity Too Large问题的解决方法
    Centos配置nginx反向代理8090端口到80端口
    超简单Centos+Docker+Halo搭建java向博客
    JAVA使用POI如何导出百万级别数据
    Mybatis的MapperRegistry错误
    Navicat连接mysql8出现1251错误
  • 原文地址:https://www.cnblogs.com/dyfzwj/p/2038466.html
Copyright © 2020-2023  润新知