如何在Axapta中创建查询?

时间:2012-06-28 10:31:55

标签: axapta dynamics-ax-2009

这与我之前的问题有关。我有一个(不那么)'复杂'查询与3连接表。这是查询:

    select  somefield
from WMSTRANSPORT INNER join GMSWmslocationwrkctr On WMSTRANSPORT.TOLOCATION = GMSWMSLOCATIONWRKCTR.WMSLOCATIONID
inner join WMSLOCATIONSUM on WMSTRANSPORT.TOLOCATION = WMSLOCATIONSUM.WMSLOCATIONID
where 
EXPEDITIONSTATUS=3 OR EXPEDITIONSTATUS =4

如何'转换'成X ++代码?

1 个答案:

答案 0 :(得分:2)

只需将ON子句更改为WHERE子句,使用==而不是=,并使用||而不是OR:

select somefield
from WMSTRANSPORT 
where (WMSTRANSPORT.EXPEDITIONSTATUS==3 || WMSTRANSPORT.EXPEDITIONSTATUS==4)
join GMSWmslocationwrkctr where WMSTRANSPORT.TOLOCATION == GMSWMSLOCATIONWRKCTR.WMSLOCATIONID
join WMSLOCATIONSUM where WMSTRANSPORT.TOLOCATION == WMSLOCATIONSUM.WMSLOCATIONID