May 6, 2021 at 10:48 pm
Hello trying to find unique values on the following table
First temporary table query (Master Data)
insert into #tempCOO select sk.CountryOfOrigin,im.partnumber,sk.Quantity,sol.id,lp.id,lpl.id,so.id,p.SerialNumber FROM sk join lpl on sk.LoadPlanLineId = lpl.id join lp on lp.id = lpl.LoadPlanId join sol(nolock) on sol.id=lpl.SalesOrderLineId join so on so.id=sol.SalesOrderId join im on im.id = sol.itemmasterid join pd on pd.content = sk.batchnumber and Pd.PackageAttributeId=37 join p on p.id=pd.PackageId where lp.Loadnumber= 'L001' order by p.SerialNumber desc
I need to find unique values for a combination of country of Origin and Part Number
Could you help me to write the querys I need?
Thanks so much
SELECT CountryOfOrigin,
PartNumber,
SUM(Quantity) Qty,
'x' Sol,
'x' LoadPlanId,
'x' SalesOrder,
'x' PalletNumber
FROM #tempCOO
GROUP BY CountryOfOrigin, PartNumber
ORDER BY CountryOfOrigin, PartNumber
May 7, 2021 at 1:15 am
This works super good:
SELECT CountryOfOrigin,
PartNumber,
SUM(Quantity) Qty,
'x' Sol,
'x' LoadPlanId,
'x' SalesOrder,
'x' PalletNumber
FROM #tempCOO
GROUP BY CountryOfOrigin, PartNumber
ORDER BY CountryOfOrigin, PartNumber
thanks a lot!!!!
May 7, 2021 at 1:15 am
thank you so much!!
Viewing 3 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply