PDF 文件中没有活动的问题

发布于 2024-12-08 14:12:03 字数 909 浏览 0 评论 0原文

我有下面的 sql 代码,显示没有活动(对于 feild AFFILIATE)

IF @affiliate <> 'ALL'
BEGIN
    INSERT INTO #NoActivity
    SELECT  bankFusiCode, 'N' 
    FROM frmmaster
    WHERE oldfirmcode = @affiliate
END
ELSE
BEGIN
    INSERT INTO #NoActivity
    SELECT a.bankFusiCode, 'N' 
    FROM frmmaster a, tblfrmlstdropdown b
    WHERE a.oldfirmcode = b.oldfirmcode
    AND b.reportnumber = '22046' 
    AND bankFusiCode IS NOT NULL
END

以同样的方式,我想要我的过程 @superproducttype 中的参数之一的代码 我们需要将每个超级产品类型(选定的)显示到数据为空的报告中。

所以我的 PDF 文件看起来像这样:

-------------------------------------------------------------------------------------
custname  price  trade   sales    person
-----------------------------------------------
super product type
------------------------------------------
           n0 activity for date range

超级产品类型在 PDF 文件中显示为空。如果没有数据,则显示超级产品类型的名称。

I am having below a sql code that dispalys NO ACTIVITY (for the feild AFFILIATE)

IF @affiliate <> 'ALL'
BEGIN
    INSERT INTO #NoActivity
    SELECT  bankFusiCode, 'N' 
    FROM frmmaster
    WHERE oldfirmcode = @affiliate
END
ELSE
BEGIN
    INSERT INTO #NoActivity
    SELECT a.bankFusiCode, 'N' 
    FROM frmmaster a, tblfrmlstdropdown b
    WHERE a.oldfirmcode = b.oldfirmcode
    AND b.reportnumber = '22046' 
    AND bankFusiCode IS NOT NULL
END

In the same way,I want a code for one of the parameter in my procedure @superproducttype
we need to display each Super Product Type (selected) to the report for which data is blank.

So my PDF file is looks like this:

-------------------------------------------------------------------------------------
custname  price  trade   sales    person
-----------------------------------------------
super product type
------------------------------------------
           n0 activity for date range

Super product type is showing empty in the PDF file. If there is no data, to display the name of super product type.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掐死时间 2024-12-15 14:12:03

如果我正确理解您的问题,那么您似乎需要使用外部联接来联接到超级产品类型表外部联接允许您从表中提取数据,即使联接表中没有匹配的记录也是如此。目前,您的查询使用内部联接,仅当两个表中都有匹配的记录时才提取数据。我还注意到您使用的是较旧的 T-SQL 语法,因此要在较旧的语法中执行外连接,您需要使用 *= 进行左外连接,使用 =* 进行右外连接。您将在 from 子句之后列出该表,然后在 where 子句中不要使用 fielda = fieldb,而是使用 fielda *= fieldb (对于左外连接)或 fielda =* fieldb (对于右外连接)。我希望这就是您正在寻找的。

If I understand your question correctly then it seems like you need to use an outer join to join to the Super Product Type table An outer join allows you to pull data from a table even when there is no matching records in the joining table. Currently, your queries are using inner joins which only pull data when there are matching records in both tables. I also notice that you are using older T-SQL syntax, so to do an outer join in the older syntax you need to use *= for left outer join and =* for right outer join. You will list the table after the from clause and then in the where clause instead of using fielda = fieldb, use fielda *= fieldb (for left outer join) or fielda =* fieldb (for right outer join). I hope this is what you were looking for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文