It's a similar issue for outer join, but I was caught out with the where keyword placement as well. The Ax 2012 example of the outer join is below, translated to Ax 2009 and I've added a second where keyword in there as well. The reason that I've highlighted this was originally I had the salesTable.PaymSpec == '' clause at the bottom of the query and therefore returning all rows from SalesTable. To me it seemed so wierd at first to see two where keywords in there!
static void Job10(Args _args)
{
SalesTable salesTable;
SalesLine salesTableLine;
struct struct4;
;
struct4 = new struct
("str SalesID;"
+ "date DeliveryDate;"
+ "real LineNum;"
+ "real SalesQty"
);
while
SELECT
*
FROM
salesTable
WHERE
salesTable.PaymSpec == ''
OUTER JOIN salesTableLine
WHERE
salesTable.SalesID == salesTableLine.SalesID
&& salesTableLine.SalesQty < 0
{
struct4.value("SalesID", salesTable.SalesID);
struct4.value("DeliveryDate", salesTable.DeliveryDate);
struct4.value("LineNum", salesTableLine.LineNum);
struct4.value("SalesQty", salesTableLine.SalesQty);
info(struct4.toString());
}
}
Now all you people need to do is think about where an order by will go... Yep, above the where clause.
No hay comentarios:
Publicar un comentario