Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics RMS (Archived)

Need to run this query please help..

Posted on by Microsoft Employee

 We are a new store that started up a while back,  i need to run this query to find items that are currently not on order and have been sold since i opened and have less then 1 in stock.  What happened was the vendor i have for my retail goods sent me only a few of this and a few of that  for some items.  I want to possibly re-order those items but since i never set reorder points until after we were running i cant seem to get a PO generated with the items i might have sold before.  I've tried under reports--items--quantity..  but i seem to not be able to parse out those items that might currently be on order. 

 

All items sold since XXX DATE
where supplier = FOO

and onhand =< 1
and currently on order is 0

*This post is locked for comments

  • TimB Profile Picture
    TimB 1,175 on at
    Re: Need to run this query please help..

    Try this code. Just change the suppliercode and solddate variables to the values you need them. Regards, Tim


    declare @SupplierCode nvarchar(50)
    declare @SoldDate datetime

    set @SupplierCode = 'Walmart'
    set @SoldDate = '5/1/2010'

    select i.* from item i
    left join (select itemid,sum(quantityordered - quantityreceivedtodate) as onorder from purchaseorderentry where purchaseorderid in (select id from purchaseorder where potype = 0 and status in (0,1)) group by itemid) o on i.id = o.itemid

    left join (select te.itemid from transactionentry te left join [transaction] t on te.transactionnumber = t.transactionnumber where t.time > @SoldDate group by te.itemid) s on i.id = s.itemid

    where i.supplierid = (select id from supplier where code = @SupplierCode)

    and i.quantity < 1
    and isnull(o.onorder,0) = 0
    and isnull(s.itemid,0) > 0

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans