17. Mai 2010 09:42
SELECT SUM(ve.[SUM$Cost Amount (Actual)]) AS 'Einkauf (MW`)',
vend.No_ AS 'Kreditorennr.',
vend.Name AS 'Name',
i.No_ AS 'Artikelnr.',
i.Description AS 'Artikelbeschreibung',
i.[Description 2] AS 'Artikelbeschreibung 2',
SUM(ile.SUM$Quantity) AS 'Lagerbestand',
YEAR(ve.[Posting Date]) as Jahr
FROM [Mandant$Value Entry$VSIFT$7] ve
INNER JOIN [Mandant$Vendor] vend
ON vend.No_ = ve.[Source No_]
INNER JOIN [Mandant$Item] i
ON i.No_ = ve.[Item No_]
INNER JOIN [Mandant$Item Ledger Entry$VSIFT$5] ile
ON ile.[Item No_] = i.No_
WHERE ((ve.[Posting Date] BETWEEN (@StartDate) AND (@EndDate)) and
(ve.[Source Type] = 2) and
(ve.[Source No_] = @VendorFilter))
GROUP BY vend.No_, vend.Name, i.No_, i.Description, i.[Description 2], YEAR(ve.[Posting Date])
17. Mai 2010 10:07
SELECT TOP 20 SUM(ve.[SUM$Cost Amount (Actual)]) AS 'Einkauf (MW`)',
vend.No_ AS 'Kreditorennr.',
vend.Name AS 'Name',
i.No_ AS 'Artikelnr.',
i.Description AS 'Artikelbeschreibung',
i.[Description 2] AS 'Artikelbeschreibung 2',
SUM(ile.SUM$Quantity) AS 'Lagerbestand',
YEAR(ve.[Posting Date]) as Jahr
FROM [Mandant$Value Entry$VSIFT$7] ve
INNER JOIN [Mandant$Vendor] vend
ON vend.No_ = ve.[Source No_]
INNER JOIN [Mandant$Item] i
ON i.No_ = ve.[Item No_]
INNER JOIN [Mandant$Item Ledger Entry$VSIFT$5] ile
ON ile.[Item No_] = i.No_
WHERE ((ve.[Posting Date] BETWEEN (@StartDate) AND (@EndDate)) and
(ve.[Source Type] = 2) and
(ve.[Source No_] = @VendorFilter))
GROUP BY vend.No_, vend.Name, i.No_, i.Description, i.[Description 2], YEAR(ve.[Posting Date])
ORDER BY SUM(ve.[SUM$Cost Amount (Actual)]) AS 'Einkauf (MW`)'
17. Mai 2010 10:15
17. Mai 2010 11:04
17. Mai 2010 11:24
18. Mai 2010 07:58
DECLARE @Nr varchar(20), @Name varchar(50)
DECLARE MyCursor CURSOR FOR
SELECT [No_], Name FROM [CRONUS AG$Vendor]
OPEN MyCursor
FETCH NEXT FROM MyCursor
INTO @Nr, @Name
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT TOP 20 SUM(ve.[SUM$Cost Amount (Actual)]) AS 'Einkauf (MW`)',
@Nr AS 'Kreditorennr.',
@Name AS 'Name',
i.No_ AS 'Artikelnr.',
i.Description AS 'Artikelbeschreibung',
i.[Description 2] AS 'Artikelbeschreibung 2',
SUM(ile.SUM$Quantity) AS 'Lagerbestand',
YEAR(ve.[Posting Date]) as Jahr
FROM [CRONUS AG$Value Entry$VSIFT$7] ve
INNER JOIN [CRONUS AG$Vendor] vend
ON vend.No_ = ve.[Source No_]
INNER JOIN [CRONUS AG$Item] i
ON i.No_ = ve.[Item No_]
INNER JOIN [CRONUS AG$Item Ledger Entry$VSIFT$5] ile
ON ile.[Item No_] = i.No_
WHERE ((ve.[Posting Date] BETWEEN (@StartDate) AND (@EndDate))
and (ve.[Source Type] = 2) and (ve.[Source No_] = @Nr))
GROUP BY vend.No_, vend.Name, i.No_, i.Description, i.[Description 2], YEAR(ve.[Posting Date])
ORDER BY SUM(ve.[SUM$Cost Amount (Actual)])
FETCH NEXT FROM MyCursor INTO @Nr, @Name
END;
CLOSE MyCursor;
DEALLOCATE MyCursor;
GO
18. Mai 2010 08:37