-1
を与えます。私はこれを行う場合でも:あなたが見るサブクエリは、私は2つのテーブルを持っている、と私はそれのサブクエリを作りたい、このようにヌル結果に
NULL AM 1585.30000000000000000000
NULL DB 1865.91000000000000000000
NULL DL 3652.43000000000000000000
NULL RD 1599.32000000000000000000
NULL ZM 571.54000000000000000000
:
SELECT V.[Freight-free Limit], PL.[Location Code], sum(Amount) as totaal --SUM([Unit Cost])
FROM [Verploegen POC$Vendor] V
FULL JOIN [Verploegen POC$Purch_ Inv_ Line] PL
ON V.No_= PL.No_
WHERE [Buy-from Vendor No_] = '3929' AND Type = 2 AND [Posting Date] BETWEEN '2016-01-01' AND '2016-12-31'
GROUP BY V.[Freight-free Limit], PL.[Location Code]
は、それがこの結果を与えます。顧客が何らかの金額を注文した場合、顧客は配送料を支払う必要はありません。それはpropertieです:たとえば、[貨物フリーリミット]
この:
SELECT [Freight-free Limit]
FROM [Verploegen POC$Vendor]
WHERE No_ = '3929'
は、結果として得られます。 350.00000000000000000000
しかし、私はサブクエリの動作を取得いけません。
ありがとうございました。
これはテーブルです:Purch_inv_line:
USE [VERPLOEGEN-NAV2009-LIVE]
GO
/****** Object: Table [dbo].[Verploegen POC$Purch_ Inv_ Line] Script Date: 08/18/2016 23:42:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Verploegen POC$Purch_ Inv_ Line](
[timestamp] [timestamp] NOT NULL,
[Document No_] [varchar](20) NOT NULL,
[Line No_] [int] NOT NULL,
[Buy-from Vendor No_] [varchar](20) NOT NULL,
[Type] [int] NOT NULL,
[No_] [varchar](20) NOT NULL,
[Location Code] [varchar](10) NOT NULL,
[Posting Group] [varchar](10) NOT NULL,
[Expected Receipt Date] [datetime] NOT NULL,
[Description] [varchar](50) NOT NULL,
[Description 2] [varchar](50) NOT NULL,
[Unit of Measure] [varchar](10) NOT NULL,
[Quantity] [decimal](38, 20) NOT NULL,
[Direct Unit Cost] [decimal](38, 20) NOT NULL,
[Unit Cost (LCY)] [decimal](38, 20) NOT NULL,
[VAT %] [decimal](38, 20) NOT NULL,
[Line Discount %] [decimal](38, 20) NOT NULL,
[Line Discount Amount] [decimal](38, 20) NOT NULL,
[Amount] [decimal](38, 20) NOT NULL,
[Amount Including VAT] [decimal](38, 20) NOT NULL,
[Unit Price (LCY)] [decimal](38, 20) NOT NULL,
[Allow Invoice Disc_] [tinyint] NOT NULL,
[Gross Weight] [decimal](38, 20) NOT NULL,
[Net Weight] [decimal](38, 20) NOT NULL,
[Units per Parcel] [decimal](38, 20) NOT NULL,
[Unit Volume] [decimal](38, 20) NOT NULL,
[Appl_-to Item Entry] [int] NOT NULL,
[Shortcut Dimension 1 Code] [varchar](20) NOT NULL,
[Shortcut Dimension 2 Code] [varchar](20) NOT NULL,
[Job No_] [varchar](20) NOT NULL,
[Indirect Cost %] [decimal](38, 20) NOT NULL,
[Pay-to Vendor No_] [varchar](20) NOT NULL,
[Inv_ Discount Amount] [decimal](38, 20) NOT NULL,
[Vendor Item No_] [varchar](20) NOT NULL,
[Gen_ Bus_ Posting Group] [varchar](10) NOT NULL,
[Gen_ Prod_ Posting Group] [varchar](10) NOT NULL,
[VAT Calculation Type] [int] NOT NULL,
[Transaction Type] [varchar](10) NOT NULL,
[Transport Method] [varchar](10) NOT NULL,
[Attached to Line No_] [int] NOT NULL,
[Entry Point] [varchar](10) NOT NULL,
[Area] [varchar](10) NOT NULL,
[Transaction Specification] [varchar](10) NOT NULL,
[Tax Area Code] [varchar](20) NOT NULL,
[Tax Liable] [tinyint] NOT NULL,
[Tax Group Code] [varchar](10) NOT NULL,
[Use Tax] [tinyint] NOT NULL,
[VAT Bus_ Posting Group] [varchar](10) NOT NULL,
[VAT Prod_ Posting Group] [varchar](10) NOT NULL,
[Blanket Order No_] [varchar](20) NOT NULL,
[Blanket Order Line No_] [int] NOT NULL,
[VAT Base Amount] [decimal](38, 20) NOT NULL,
[Unit Cost] [decimal](38, 20) NOT NULL,
[System-Created Entry] [tinyint] NOT NULL,
[Line Amount] [decimal](38, 20) NOT NULL,
[VAT Difference] [decimal](38, 20) NOT NULL,
[VAT Identifier] [varchar](10) NOT NULL,
[IC Partner Ref_ Type] [int] NOT NULL,
[IC Partner Reference] [varchar](20) NOT NULL,
[Prepayment Line] [tinyint] NOT NULL,
[IC Partner Code] [varchar](20) NOT NULL,
[Posting Date] [datetime] NOT NULL,
[Job Task No_] [varchar](20) NOT NULL,
[Job Line Type] [int] NOT NULL,
[Job Unit Price] [decimal](38, 20) NOT NULL,
[Job Total Price] [decimal](38, 20) NOT NULL,
[Job Line Amount] [decimal](38, 20) NOT NULL,
[Job Line Discount Amount] [decimal](38, 20) NOT NULL,
[Job Line Discount %] [decimal](38, 20) NOT NULL,
[Job Unit Price (LCY)] [decimal](38, 20) NOT NULL,
[Job Total Price (LCY)] [decimal](38, 20) NOT NULL,
[Job Line Amount (LCY)] [decimal](38, 20) NOT NULL,
[Job Line Disc_ Amount (LCY)] [decimal](38, 20) NOT NULL,
[Job Currency Factor] [decimal](38, 20) NOT NULL,
[Job Currency Code] [varchar](20) NOT NULL,
[Prod_ Order No_] [varchar](20) NOT NULL,
[Variant Code] [varchar](10) NOT NULL,
[Bin Code] [varchar](20) NOT NULL,
[Qty_ per Unit of Measure] [decimal](38, 20) NOT NULL,
[Unit of Measure Code] [varchar](10) NOT NULL,
[Quantity (Base)] [decimal](38, 20) NOT NULL,
[FA Posting Date] [datetime] NOT NULL,
[FA Posting Type] [int] NOT NULL,
[Depreciation Book Code] [varchar](10) NOT NULL,
[Salvage Value] [decimal](38, 20) NOT NULL,
[Depr_ until FA Posting Date] [tinyint] NOT NULL,
[Depr_ Acquisition Cost] [tinyint] NOT NULL,
[Maintenance Code] [varchar](10) NOT NULL,
[Insurance No_] [varchar](20) NOT NULL,
[Budgeted FA No_] [varchar](20) NOT NULL,
[Duplicate in Depreciation Book] [varchar](10) NOT NULL,
[Use Duplication List] [tinyint] NOT NULL,
[Responsibility Center] [varchar](10) NOT NULL,
[Cross-Reference No_] [varchar](20) NOT NULL,
[Unit of Measure (Cross Ref_)] [varchar](10) NOT NULL,
[Cross-Reference Type] [int] NOT NULL,
[Cross-Reference Type No_] [varchar](30) NOT NULL,
[Item Category Code] [varchar](10) NOT NULL,
[Nonstock] [tinyint] NOT NULL,
[Purchasing Code] [varchar](10) NOT NULL,
[Product Group Code] [varchar](10) NOT NULL,
[Return Reason Code] [varchar](10) NOT NULL,
[Allow Condition Disc_] [tinyint] NOT NULL,
[Allow Prod_ Gr_ Cond_ Disc_] [tinyint] NOT NULL,
[Condition Discount %] [decimal](38, 20) NOT NULL,
[Condition Discount Amount] [decimal](38, 20) NOT NULL,
[Prod_ Gr_ Cond_ Disc_ %] [decimal](38, 20) NOT NULL,
[Prod_ Gr_ Cond_ Disc_ Amount] [decimal](38, 20) NOT NULL,
[Vend__Item Discount %] [decimal](38, 20) NOT NULL,
[Vend__Item Disc_ Amount] [decimal](38, 20) NOT NULL,
[Order Type Code] [varchar](10) NOT NULL,
[Price Factor] [decimal](38, 20) NOT NULL,
[Unit Cost (Unit of Measure)] [decimal](38, 20) NOT NULL,
[Unit of Meas_ Code (Unit Cost)] [varchar](10) NOT NULL,
[Bonus Code] [varchar](10) NOT NULL,
[Item Bonus Group] [varchar](10) NOT NULL,
[Allow Bonus (Direct Unit Cost)] [tinyint] NOT NULL,
[Allow Bonus] [tinyint] NOT NULL,
[Shipping No_] [varchar](20) NOT NULL,
[Cost Component] [varchar](10) NOT NULL,
[Cost Allocation] [tinyint] NOT NULL,
[Min_ Order Amount (LC)] [decimal](38, 20) NOT NULL,
[Min_ Order Quantity (Base)] [decimal](38, 20) NOT NULL,
[Unit Volume (Total)] [decimal](38, 20) NOT NULL,
[Line Amount (LC)] [decimal](38, 20) NOT NULL,
[Unit of Measure (UOM)] [varchar](10) NOT NULL,
[Quantity (UOM)] [decimal](38, 20) NOT NULL,
[Original Quantity] [decimal](38, 20) NOT NULL,
[Cancelled] [tinyint] NOT NULL,
[Order No_] [varchar](20) NOT NULL,
[Order Line No_] [int] NOT NULL,
[Source Line No_] [int] NOT NULL,
[Waste Disposal Fee] [tinyint] NOT NULL,
[Price Unit of Measure Code] [varchar](10) NOT NULL,
[Price Unit of Measure] [varchar](10) NOT NULL,
[Qty_ per Price UOM] [decimal](38, 20) NOT NULL,
[Direct Unit Cost (Price)] [decimal](38, 20) NOT NULL,
[Routing No_] [varchar](20) NOT NULL,
[Operation No_] [varchar](10) NOT NULL,
[Work Center No_] [varchar](20) NOT NULL,
[Prod_ Order Line No_] [int] NOT NULL,
[Overhead Rate] [decimal](38, 20) NOT NULL,
[Routing Reference No_] [int] NOT NULL,
CONSTRAINT [Verploegen POC$Purch_ Inv_ Line$0] PRIMARY KEY CLUSTERED
(
[Document No_] ASC,
[Line No_] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [Data Filegroup 1]
) ON [Data Filegroup 1]
GO
SET ANSI_PADDING OFF
GO
と、これはベンダーのテーブルです:
:このような結果とSELECT VPL.[Location Code], sum(VPL.Amount) as totaal, VPL.[Buy-from Vendor No_] --, V.[Freight-free Limit]
FROM [Verploegen POC$Purch_ Inv_ Line] VPL
WHERE VPL.[Buy-from Vendor No_] = '3929' AND VPL.Type = 2 AND [Posting Date] BETWEEN '2016-01-01' AND '2016-12-31'
GROUP by VPL.[Location Code], VPL.[Buy-from Vendor No_]--, VPL.[Vendor Item No_]
ORDER BY VPL.[Location Code]
:
USE [VERPLOEGEN-NAV2009-LIVE]
GO
/****** Object: Table [dbo].[Verploegen POC$Vendor] Script Date: 08/18/2016 23:43:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Verploegen POC$Vendor](
[timestamp] [timestamp] NOT NULL,
[No_] [varchar](20) NOT NULL,
[Name] [varchar](50) NOT NULL,
[Search Name] [varchar](50) NOT NULL,
[Name 2] [varchar](50) NOT NULL,
[Address] [varchar](50) NOT NULL,
[Address 2] [varchar](50) NOT NULL,
[City] [varchar](30) NOT NULL,
[Contact] [varchar](50) NOT NULL,
[Phone No_] [varchar](30) NOT NULL,
[Telex No_] [varchar](20) NOT NULL,
[Our Account No_] [varchar](20) NOT NULL,
[Territory Code] [varchar](10) NOT NULL,
[Global Dimension 1 Code] [varchar](20) NOT NULL,
[Global Dimension 2 Code] [varchar](20) NOT NULL,
[Budgeted Amount] [decimal](38, 20) NOT NULL,
[Vendor Posting Group] [varchar](10) NOT NULL,
[Currency Code] [varchar](10) NOT NULL,
[Language Code] [varchar](10) NOT NULL,
[Statistics Group] [int] NOT NULL,
[Payment Terms Code] [varchar](10) NOT NULL,
[Fin_ Charge Terms Code] [varchar](10) NOT NULL,
[Purchaser Code] [varchar](10) NOT NULL,
[Shipment Method Code] [varchar](10) NOT NULL,
[Shipping Agent Code] [varchar](10) NOT NULL,
[Invoice Disc_ Code] [varchar](20) NOT NULL,
[Country_Region Code] [varchar](10) NOT NULL,
[Blocked] [int] NOT NULL,
[Pay-to Vendor No_] [varchar](20) NOT NULL,
[Priority] [int] NOT NULL,
[Payment Method Code] [varchar](10) NOT NULL,
[Last Date Modified] [datetime] NOT NULL,
[Application Method] [int] NOT NULL,
[Prices Including VAT] [tinyint] NOT NULL,
[Fax No_] [varchar](30) NOT NULL,
[Telex Answer Back] [varchar](20) NOT NULL,
[VAT Registration No_] [varchar](20) NOT NULL,
[Gen_ Bus_ Posting Group] [varchar](10) NOT NULL,
[Picture] [image] NULL,
[Post Code] [varchar](20) NOT NULL,
[County] [varchar](30) NOT NULL,
[E-Mail] [varchar](80) NOT NULL,
[Home Page] [varchar](80) NOT NULL,
[No_ Series] [varchar](10) NOT NULL,
[Tax Area Code] [varchar](20) NOT NULL,
[Tax Liable] [tinyint] NOT NULL,
[VAT Bus_ Posting Group] [varchar](10) NOT NULL,
[Block Payment Tolerance] [tinyint] NOT NULL,
[IC Partner Code] [varchar](20) NOT NULL,
[Prepayment %] [decimal](38, 20) NOT NULL,
[Primary Contact No_] [varchar](20) NOT NULL,
[Responsibility Center] [varchar](10) NOT NULL,
[Location Code] [varchar](10) NOT NULL,
[Lead Time Calculation] [varchar](32) NOT NULL,
[Base Calendar Code] [varchar](10) NOT NULL,
[Chamber of Commerce] [varchar](11) NOT NULL,
[Prices on order] [tinyint] NOT NULL,
[Tradium Account] [int] NOT NULL,
[EAN adrescode] [varchar](13) NOT NULL,
[Manufacturer] [tinyint] NOT NULL,
[Transaction Mode Code] [varchar](20) NOT NULL,
[Bank Account Code] [varchar](10) NOT NULL,
[Freight-free Limit] [decimal](38, 20) NOT NULL,
[Minimum Order Amount] [decimal](38, 20) NOT NULL,
[Find Best Price] [tinyint] NOT NULL,
[Discount Calculation] [int] NOT NULL,
[Print Conditions] [tinyint] NOT NULL,
[No Prices on Order] [tinyint] NOT NULL,
[Vendor Bonus Group] [varchar](10) NOT NULL,
[Cost Allocation] [tinyint] NOT NULL,
[Minimum Order Volume] [decimal](38, 20) NOT NULL,
[Apply Waste Disposal Fee] [tinyint] NOT NULL,
[Purchase budget] [decimal](38, 20) NOT NULL,
[Credit Limit] [decimal](38, 20) NOT NULL,
[Performance Score Mandatory] [tinyint] NOT NULL,
[Melding] [varchar](30) NOT NULL,
[Partner Type] [int] NOT NULL,
[2BA] [tinyint] NOT NULL,
[Traffic Light Image Solvency] [image] NULL,
CONSTRAINT [Verploegen POC$Vendor$0] PRIMARY KEY CLUSTERED
(
[No_] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [Data Filegroup 1]
) ON [Data Filegroup 1] TEXTIMAGE_ON [Data Filegroup 1]
GO
SET ANSI_PADDING OFF
GO
私はこれを持っています
AM 1585.30000000000000000000 3929
DB 1865.91000000000000000000 3929
DL 3652.43000000000000000000 3929
RD 1599.32000000000000000000 3929
ZM 571.54000000000000000000 3929
しかし、どのようにpropertieを実装する: 貨物フリーリミット
間違っpropertieを使用していましたJOIN 'とは、一致するものがなければ何も返されません。 'FROM'節の後にテーブルの順序に応じて' LEFT JOIN'または 'RIGHT JOIN'を使うことができます。テーブル構造、サンプルデータなどを投稿すると役に立ちます。 – BJones
こんにちは、ご意見ありがとうございます。私はテーブルを追加しました – SavantCode
私はそのうちのどの部分が "サブクエリ"か分かりません。 – shawnt00