sql 客户咨询自定义公式

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 客户咨询自定义公式相关的知识,希望对你有一定的参考价值。


Client Inquiry Custom Formulas [ New ]
Options

‎06-05-2015 01:46 PM

Custom Formulas 

 

    Client Inquiry: Last receipt Date, from Client Invoice Inquiry.

Note: You can substitute rdate for any field on the Axreceipt table you might want.

 

SELECT rDate

 FROM(

   SELECT DISTINCT TOP 1

   ciKey

   ,rdate

   FROM  AxReceipt

      LEFT JOIN AxGLDetail         ON rKey = gldReceipt

      LEFT JOIN AxTransaction    ON gldTransaction = tKey

      LEFT JOIN AxClientInvoice  ON tClientInvoice = ciKey

   WHERE gldIsCurrent = 1 AND gldReceipt IS NOT NULL

   AND ciKey = [Client Invoice Key]

   ORDER BY rDate desc

   )Temp

  

    Client Inquiry: Add Project Department to Client Receipt Inquiry

SELECT prjEntityDescription FROM PROJECT WHERE prjkey = [Project Key]

 

    Client Inquiry: Add First Client Invoice Number

SELECT TOP 1 ciInvoiceDate FROM AxClientInvoice WHERE ciClient = [Client Key] AND ciStatus = 4 ORDER BY ciInvoiceDate

 

    Client Inquiry: Add Receipts for a date range

SELECT ISNULL(-SUM(gldAmount), 0.0)

FROM AxGLDetail

            JOIN AxReceipt ON gldReceipt = rKey

WHERE gldControlAccountType IN (2,4)

            AND rClient = [Client Key]

            AND rDate BETWEEN '01-01-1900' AND '12-31-2078'

GROUP BY rClient

 

To Use these Custom Formulas

Copy the desired Formula into the definition of your Inquiry column.

以上是关于sql 客户咨询自定义公式的主要内容,如果未能解决你的问题,请参考以下文章

SQL中的窗口函数总结

根据生日自动计算年龄

Crystal Reports 2013:页眉公式字段不一致

如何在 EF Core 5 中为自定义 SQL 配置导航属性

delphi 自定义公式

如何优化Oracle在where条件中用了自定义函数的SQL语句