【问题标题】:field not showing up in on section of report字段未显示在报告部分
【发布时间】:2012-03-26 15:41:02
【问题描述】:

我的问题越来越难了,很明显你教的很好! 在这一个中,我有一份打印卡确认详细信息的报告。 除了我将确认请求更改为“周转请求”之外,所有字段都填写得很好,在这种情况下,CTYlong 中没有显示的字段对于“周转请求”的所有实例都保持空白。这是给ssrs的 我就交给你了!

IF @MsgType = 200 
BEGIN 
SELECT DISTINCT MsgType = 'confirm Request' , resp.dtTimeRPO as     HostTime , 
                                                          resp.sSTANExternalI as STAN , 
 resp.sterminal_TerminalID as TerminalID ,      resp.ssell_CardAcceptorIDCode as    

 sellID , resp.ssell_CardAcceptorNameLoc as   sellName ,   

 STUFF(resp.span_Pan,7,(LEN(resp.span_Pan)-10), REPLICATE('X',(LEN(resp.span_Pan)-10)))   
 as PAN , CAST(MONTH(resp.dtpan_ExpiryDate) as varchar(2)) + '/' +   
 CAST(YEAR(resp.dtpan_ExpiryDate) as char(4)) as ExpDate , CAST(resp.namounts_cAmount   
 as float)/100 as Amount , resp.namounts_CurrencyCodetx as CurrencyCode , 
 resp.nActionCode as RC , rc.rcInfo as RCDesc , resp.sconfirmCode as confirmCode , 
   ssell_CountryShort2 AS sell_Country , ctylong , 

    (SELECT DATEPART(ss, resp.dtTimeRPO - req.dtTimeRQI) FROM dbo.txHistory as    
   req (NOLOCK) 

 WHERE req.sSTANExternalI = resp.sSTANExternalI 
 AND 
 req.namounts_cAmount = resp.namounts_cAmount 
 AND req.dtLocalDateTime = resp.dtLocalDateTime 
 AND RTRIM(req.sPHProfile) = @Head 
AND (req.sconfirmCode = '' 
 AND req.nActionCode = 0) 
AND req.dtTimeRQI BETWEEN DATEADD(mi, -1, @StartDate) 
 AND @EndDate ) as Duration 
 FROM dbo.txHistory as resp (NOLOCK) 
 INNER JOIN dbo.replyCode as rc (NOLOCK) 
 ON resp.nActionCode = rc.rcCode 
 inner join country (nolock) 
 on nsell_countrycode = ctycode 
WHERE resp.dtTimeRPO 
BETWEEN @StartDate AND @EndDate 
AND
 resp.eMTI = @MsgType
AND 
RTRIM(resp.sPHProfile) = @Head
AND NOT (resp.sconfirmCode = '' AND resp.nActionCode = 0) 
ORDER BY resp.dtTimeRPO 
END
ELSE 
BEGIN 
 SELECT DISTINCT MsgType = 'turnaround Request' , resp.dtTimeRPO as HostTime ,   
 resp.sSTANExternalI as STAN , resp.sterminal_TerminalID as TerminalID ,   
  resp.ssell_CardAcceptorIDCode as sellID , resp.ssell_CardAcceptorNameLoc   
  as sellName , STUFF(resp.span_Pan,7,(LEN(resp.span_Pan)-10), REPLICATE('X',
  (LEN(resp.span_Pan)-10))) as PAN , CAST(MONTH(resp.dtpan_ExpiryDate) as varchar(2)) +   
 '/' + CAST(YEAR(resp.dtpan_ExpiryDate) as char(4)) as ExpDate ,   
 CAST(resp.namounts_cAmount as float)/100 as Amount ,   
  resp.namounts_CurrencyCodetx as CurrencyCode , resp.nActionCode as RC , 
  rc.rcInfo as RCDesc , resp.sconfirmCode as confirmCode , 

  (SELECT DATEPART(ss, resp.dtTimeRPO - req.dtTimeRQI) 
 FROM dbo.txHistory as req (NOLOCK)
 WHERE req.sSTANExternalI = resp.sSTANExternalI AND req.namounts_cAmount =     
  resp.namounts_cAmount AND req.dtLocalDateTime = resp.dtLocalDateTime
 AND
  RTRIM(req.sPHProfile) = @Head
  AND 
  (req.eMTI = 420 AND req.nActionCode = 400)
 AND 
 req.dtTimeRQI BETWEEN DATEADD(mi, -1, @StartDate) AND @EndDate ) 
as Duration 
FROM dbo.txHistory as resp (NOLOCK) 
INNER JOIN dbo.replyCode as rc (NOLOCK) ON resp.nActionCode = rc.rcCode WHERE    
 resp.dtTimeRPO 
BETWEEN 
@StartDate 
 AND @EndDate AND resp.eMTI = @MsgType 
 AND RTRIM(resp.sPHProfile) = @Head 
 ORDER BY resp.dtTimeRPO END

【问题讨论】:

    标签: sql tsql reporting-services


    【解决方案1】:

    对于撤销请求,您不包括 ctylong 字段。基本上你的列在你的两个查询中没有排列。你真的应该更好地格式化你的查询,这是一场噩梦。

    编辑:这就是我喜欢的查询格式

    SELECT
       column1,
       column2,
       column3
    FROM
       table_1 INNER JOIN
       table_2 ON table_1.id = table_2.id INNER JOIN
       (
          SELECT
             column_4
          FROM
             table_3
       ) t3 ON table_2.id = t3.id
    WHERE
       table_1.id = 1000 AND
       table_2.id = 2000 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-10
      • 1970-01-01
      • 1970-01-01
      • 2014-03-08
      • 1970-01-01
      相关资源
      最近更新 更多