Skip to main content
Dynamics 365 Community / Forums / Retail Industry forum / i want to use sql quer...
Unanswered

i want to use sql query in x++ i am unable to write

editSubscribe (0) ShareShare
ReportReport
Posted on by

Hello,

i have a simple query of sql but i am unable to write the query in x++ please see the below 

my sql query 

select * from MZNUNInventOnhandItemPricesHistory a
inner join INVENTDIM d on d.INVENTDIMID = a.INVENTDIMID
where a.FROMDATE = (select max(b.FROMDATE) from MZNUNInventOnhandItemPricesHistory b)

i have written the below query but unable to wirte query for where clause

public void populateinventtrans()

{
MZNUNInventOnhandItemPricesHistory inventOnhandItemPricesHistory;
delete_from _mak_priceTagtbl;
insert_recordset _mak_priceTagtbl(itemid,itemname,msp,smp,purchaseprice,wholesalesprice,gfprice,retailpricesrp,companyfix,fromdate,todate,comments,fixcommission)
select itemid,itemname,msp,smp,purchaseprice,wholesalesprice,gfprice,retailpricesrp,companyfix,fromdate,todate,comments,fixcommission from inventOnhandItemPricesHistory
;
}

Please help me in this. how i can write this query in x++ while i have tried many of times.

Regards,