简体   繁体   English

AX2012中的快速选择声明

[英]Very quick select statement in AX2012

What's your method of quickly viewing results of such statements? 您快速查看此类陈述结果的方法是什么?

SELECT * FROM CustInvoiceJour`
JOIN CustInvoiceTrans WHERE CustInvoiceJour.InvoiceId == CustInvoiceTrans.InvoiceId`
WHERE CustInvoiceTrans.ItemId == 'MBIIRKT0014'

I'm looking for something like table explorer, but supporting joins. 我正在寻找像表浏览器这样的东西,但支持连接。

If this is just for quick data checks, I just usually use info(strFmt(...)); 如果这只是用于快速数据检查,我通常只使用info(strFmt(...)); statements to output what I need to see. 语句输出我需要看到的内容。

Another way, if you're stronger in SQL is to actually use SQL . 另一种方法,如果你在SQL更强大,那就是实际使用SQL You can use the keywords generateonly and forceLiterals to generate the SQL statement and force literal values. 您可以使用关键字generateonlyforceLiterals来生成SQL语句和强制文字值。

Here is your AX SQL statement rewritten: 这是您重写的AX SQL语句:

SELECT generateonly forceLiterals * FROM CustInvoiceJour
    JOIN CustInvoiceTrans
    WHERE CustInvoiceJour.InvoiceId == CustInvoiceTrans.InvoiceId   &&
          CustInvoiceTrans.ItemId == 'MBIIRKT0014';

info(CustInvoiceJour.getSQLStatement());

Then you can run that SQL in SQL and do what you need. 然后你就可以运行SQLSQL和你所需要的。

Your X++ select has two WHERE 's in it and is malformed, but I fixed it. 你的X++选择中有两个WHERE ,并且格式不正确,但我修复了它。

If you need to make joins In my case I create a simple View object . 如果你需要连接在我的情况下,我创建一个简单的View对象

Table CustInvoiceJour principal and then joins to CustInvoiceTrans CustInvoiceJour主体然后加入CustInvoiceTrans

Views located in AOT/Data Dictionary/Views 位于AOT /数据字典/视图 视图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM