Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.
select tblServiceOrders.ARCustomerNumber, tblServiceOrders.SONumber, tblServiceOrders.Status AS ServiceStatus, tblInvoices.status AS InvoiceStatus, tblInvoices.InvoiceDate, SUM(tblInvoiceDetail.TotalPostedCost) AS DetailTotalPostedCost, SUM(tblInvoiceDetail.TotalSellingPrice) AS DetailTotalSellingPrice, SUM(tblInvoiceDetail.TotalSellingPrice) - SUM(tblInvoiceDetail.TotalPostedCost) as Margin FROM tblInvoices INNER JOIN tblAccounts ON tblInvoices.AccountNumber = tblAccounts.AccountNumber LEFT OUTER JOIN tblReps ON tblInvoices.SalesRep = tblReps.RepNumber INNER JOIN tblInvoiceDetail ON tblInvoices.InvoiceNumber = tblInvoiceDetail.InvoiceNumber LEFT OUTER JOIN tblInvoiceAssemblyDetail ON tblInvoiceDetail.InvoiceDetailKeyID = tblInvoiceAssemblyDetail.FKInvoiceDetail INNER JOIN tblServiceOrders ON tblInvoices.AccountNumber = tblServiceOrders.AccountNumber WHERE tblInvoices.status = 'Posted' AND tblInvoiceDetail.TotalSellingPrice > 0 GROUP BY tblServiceOrders.ARCustomerNumber, tblServiceOrders.SONumber, tblServiceOrders.Status,tblInvoices.Status, tblInvoices.InvoiceDate ORDER By tblServiceOrders.SONumber ASC;
|Sharepoint 2016 - all-in-one-server vs. two servers||24||35|
|How to disable/enable multiple sql jobs in efficient way||11||74|
|Whats wrong with this query||21||23|
|How to query LOCK_ESCALATION||4||22|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!