27. September 2017 13:06
Sum("Sales Invoice Line".Quantity WHERE (Document No.=FIELD(No.),Type=CONST(Item)))
Select Sum(dbo.[Sales Invoice Line].[Quantity]) FROM dbo.[Sales Invoice Line].[Quantity]
WHERE (
/*dbo.[Sales Invoice Line].[Document No_] = dbo.[Sales Invoice Line].[No_] and*/
dbo.[Sales Invoice Line].[Type] like 'Item'
GROUP BY dbo.[Sales Invoice Line].[No_]) AS [Total Quantity]
27. September 2017 13:31
27. September 2017 13:41
27. September 2017 13:44
27. September 2017 13:49
27. September 2017 13:57
27. September 2017 13:59
Meldung 8120, Ebene 16, Status 1, Prozedur A_RechnungGutschrift, Zeile 4
Die dbo."iwas".Posting Date-Spalte ist in der Auswahlliste ungültig, da sie nicht in einer Aggregatfunktion und nicht in der GROUP BY-Klausel enthalten ist.
27. September 2017 15:08
27. September 2017 15:24
27. September 2017 15:37
27. September 2017 16:03
ALTER VIEW [dbo].[A_RechnungGutschrift] AS
SELECT
dbo.[IWAS$Sales Invoice Header].[Posting Date] AS [Buchungsdatum],
dbo.[IWAS$Sales Invoice Header].[Agent No_] AS [Vertreternummer],
dbo.[IWAS$Sales Invoice Header].[Order Season] AS [Auftragssaison] ,
dbo.[IWAS$Sales Invoice Header].[Order Collection] AS Auftragskollektion,
dbo.[IWAS$Sales Invoice Header].[Document Date] AS [Belegdatum],
dbo.[IWAS$Sales Invoice Header].[No_] AS [Nr.],
(SELECT SUM(dbo.[IWAS$Sales Invoice Line].[Quantity]) AS [Total Quantity] FROM dbo.[IWAS$Sales Invoice Line] WHERE (
dbo.[IWAS$Sales Invoice Line].[Document No_] = dbo.[IWAS$Sales Invoice Header].[No_] AND
dbo.[IWAS$Sales Invoice Line].[Type] = '2' )
) AS [Total Quantity],
dbo.[IWAS$Sales Invoice Header].[Sell-to Search Name] AS [Verkauf an Suchbegriff],
dbo.[IWAS$Sales Invoice Header].[Sell-to Customer No_] AS [Verkauf an Deb. Nr.],
dbo.[IWAS$Sales Invoice Header].[Sell-to Customer Name] AS [Verk. An Name],
dbo.[IWAS$Sales Invoice Header].[Sell-to City] AS [Verk. an Ort],
dbo.[IWAS$Sales Invoice Header].[Currency Code] AS [Währungscode],
(Select SUM(dbo.[IWAS$Sales Invoice Line].[Amount]) AS [Betrag] FROM dbo.[IWAS$Sales Invoice Line] WHERE (
dbo.[IWAS$Sales Invoice Line].[Document No_] = dbo.[IWAS$Sales Invoice Header].[No_]))
AS [Betrag] ,
dbo.[IWAS$Sales Invoice Header].[Sell-to Country_Region Code],
dbo.[IWAS$Sales Invoice Header].[Order Type (variable)] AS [Auftragsart variabel],
(CASE dbo.[IWAS$Sales Invoice Header].[Business Type] WHEN '0' THEN 'Großhandel' WHEN '1' THEN 'Einzelhandel' END) AS Kundengruppe,
dbo.[IWAS$Sales Invoice Header].[VAT Bus_ Posting Group] AS [Mwst-Geschäftsbuchungsgruppe],
(Case dbo.[IWAS$Sales Invoice Header].[Order Type] WHEN '0' THEN 'Vororder' WHEN '1' THEN 'Nachorder' WHEN '2' THEN 'Muster' WHEN '3' THEN 'Posten'END) AS [Belegzeile Art],
dbo.[IWAS$Sales Invoice Header].[Return Doc_ No_] AS [Retourenbelegnr],
dbo.[IWAS$Sales Invoice Header].[Order Type] AS [Auftragsart des Verkaufsauftrages],
dbo.[IWAS$Sales Invoice Header].[External Document No_] AS [Externe Belegnummer],
dbo.[IWAS$Sales Invoice Header].[Bal_ Account No_] AS [Sachkontonr.]
FROM dbo.[IWAS$Sales Invoice Header], dbo.[IWAS$Sales Invoice Line]
UNION SELECT
dbo.[IWAS$Sales Cr_Memo Header].[Posting Date] AS [Buchungsdatum],
dbo.[IWAS$Sales Cr_Memo Header].[Agent No_] AS [Vertreternummer],
dbo.[IWAS$Sales Cr_Memo Header].[Order Season] AS [Auftragssaison],
dbo.[IWAS$Sales Cr_Memo Header].[Order Collection] AS Auftragskollektion,
dbo.[IWAS$Sales Cr_Memo Header].[Document Date] AS [Belegdatum],
dbo.[IWAS$Sales Cr_Memo Header].[No_] AS [Nr.],
NULL AS [Total Quantity],
dbo.[IWAS$Sales Cr_Memo Header].[Sell-to Search Name] AS [Verkauf an Suchbegriff],
dbo.[IWAS$Sales Cr_Memo Header].[Sell-to Customer No_] AS [Verkauf an Deb. Nr.],
dbo.[IWAS$Sales Cr_Memo Header].[Sell-to Customer Name] AS [Verk. an Name],
dbo.[IWAS$Sales Cr_Memo Header].[Sell-to City] AS [Verk. an Ort],
dbo.[IWAS$Sales Cr_Memo Header].[Currency Code] AS [Währungscode],
(SELECT SUM(dbo.[IWAS$Sales Invoice Line].[Amount]) AS [Betrag] FROM dbo.[IWAS$Sales Invoice Header] WHERE (
dbo.[IWAS$Sales Invoice Line].[Document No_] = dbo.[IWAS$Sales Invoice Header].[No_]))
AS [Betrag] ,
dbo.[IWAS$Sales Cr_Memo Header].[Sell-to Country_Region Code] AS [Verkauf an Länder-/Regionscode],
dbo.[IWAS$Sales Cr_Memo Header].[Order Type (variable)] AS [Auftragsart variabel],
(CASE dbo.[IWAS$Sales Cr_Memo Header].[Business Type] WHEN '0' THEN 'Großhandel' WHEN '1' THEN 'Einzelhandel' END) AS Kundengruppe,
dbo.[IWAS$Sales Cr_Memo Header].[VAT Bus_ Posting Group] AS [Mwst-Geschäftsbuchungsgruppe],
(Case dbo.[IWAS$Sales Cr_Memo Header].[Order Type] WHEN '0' THEN 'Vororder' WHEN '1' THEN 'Nachorder' WHEN '2' THEN 'Muster' WHEN '3' THEN 'Posten' END) AS [Belegzeile Art],
dbo.[IWAS$Sales Cr_Memo Header].[Return Doc_ No_] AS Retourenbelegnr,
dbo.[IWAS$Sales Cr_Memo Header].[Order Type] AS [Auftragsart des Verkaufsauftrages],
dbo.[IWAS$Sales Cr_Memo Header].[External Document No_] AS [Externe Belegnummer],
dbo.[IWAS$Sales Cr_Memo Header].[Bal_ Account No_] AS [Sachkontonr.]
FROM dbo.[IWAS$Sales Cr_Memo Header] , dbo.[IWAS$Sales Invoice Line]
GO
27. September 2017 16:54
karlNAV2009 hat geschrieben: FROM dbo.[IWAS$Sales Invoice Header], dbo.[IWAS$Sales Invoice Line]
SELECT
a.[Posting Date] AS [Buchungsdatum],
(SELECT SUM(a2.[Quantity]) AS [Total Quantity] FROM dbo.[test$Sales Invoice Line] a2 WHERE (
a2.[Document No_] = a.[No_] AND
a2.[Type] = '2' )
) AS [Total Quantity]
FROM dbo.[test$Sales Invoice Header] as a
28. September 2017 08:12