× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



HI I have a SQL that I have to modify.
 
Custnmbr is in the table Customerbudget and this is the parameter, but we only have customer name as the parameter, in the Reporting System. I need to have a join that will take the Customername from the user and locate the correct number keeping this SQL working correctly as it is, I  need to have the user enter the Customer name and lookup if you will the Custnmbr, and let the SQL process as it is.: (  I suffer a bit from good old use Chain mentality).
 
SELECT   Sum("SOP10200"."XTNDPRCE") XTNDPRCE, Sum("SOP10200"."QUANTITY") QUANTITY,
DATEADD(M,DATEDIFF(M,0,SOP10100.DOCDATE),0) ID, "IV40600"."UserCatLongDescr", "IV00101"."ITEMNMBR",
"IV00101"."ITEMDESC",AVG(CustomerBudget.BudgetAmount) as Budget
FROM   (((("dbo"."SOP10100" "SOP10100" INNER JOIN "dbo"."SOP10200" "SOP10200"
 ON "SOP10100"."SOPNUMBE"="SOP10200"."SOPNUMBE")
INNER JOIN
 "dbo"."CustomerBudget" "CustomerBudget"     ON "SOP10100"."CUSTNMBR"="CustomerBudget"."CUSTNMBR")
 LEFT OUTER JOIN "dbo"."SOP10106" "SOP10106"
  ON ("SOP10100"."SOPTYPE"="SOP10106"."SOPTYPE")
AND ("SOP10100"."SOPNUMBE"="SOP10106"."SOPNUMBE"))
INNER JOIN "dbo"."IV00101" "IV00101"
 ON "SOP10200"."ITEMNMBR"="IV00101"."ITEMNMBR")
INNER JOIN "dbo"."IV40600" "IV40600"
 ON ("IV00101"."ITMGEDSC"="IV40600"."USCATVAL")
 AND ("CustomerBudget"."USCATVAL"="IV40600"."USCATVAL")
 
WHERE  "CustomerBudget"."CUSTNMBR"=@CUSTNMBR
AND "SOP10100"."SOPTYPE"=1 and (SOP10100.DOCDATE between @FromDate and @ToDate)
group by DATEADD(M,DATEDIFF(M,0,SOP10100.DOCDATE),0), "IV40600"."UserCatLongDescr", "IV00101"."ITEMNMBR",
"IV00101"."ITEMDESC"
Order by  iv40600.UserCatLongDescr, iv00101.ITEMDESC



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.