Hi guys,
I am looking for a little help from someone with sql experiece. I have the regular detailed sales report from rms 2.0 but I am looking to add the supplier table to the report and also to be able to group it by supplier. I would appreciate any advice or direction
this is what I currently have which will group it by category
PreQuery1 = <BEGIN>
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'ViewItems') DROP VIEW ViewItems
<END>
PreQuery2 = <BEGIN>
CREATE VIEW ViewItems AS
SELECT
CASE WHEN Category.ID IS NULL THEN 0 ELSE Category.ID END AS CategoryID,
SUM(Item.Quantity) as Quantity,
SUM(Item.Quantity * Item.Cost) as InvCost
FROM Item
LEFT JOIN Category ON Item.CategoryID = Category.ID
GROUP BY Category.ID
<END>
TablesQueried = <BEGIN>
FROM Item
LEFT JOIN TransactionEntry WITH(NOLOCK) ON Item.ID = TransactionEntry.ItemID
INNER JOIN [Transaction] WITH(NOLOCK) ON TransactionEntry.TransactionNumber = [Transaction].TransactionNumber
LEFT JOIN Category WITH(NOLOCK) ON Item.CategoryID = Category.ID
LEFT JOIN Supplier WITH(NOLOCK) ON Item.SupplierID = Supplier.ID
LEFT JOIN ViewItems WITH(NOLOCK) ON Item.CategoryID = ViewItems.CategoryID
<END>
SelCriteria = ""
GroupBy = "Category.ID, Category.Name"
SortOrder = ""
End ReportSummary
Thanks in advance,
kind regards,
Margaret
*This post is locked for comments