-4
我正在處理的是我必須從4個不同的表中獲取數據。我唯一的問題是「where」子句以及最後一次加入。我需要知道我做錯了什麼謝謝SQL Server內部加入錯誤
DECLARE @Year INT
SET @Year = 2014
SELECT c.program_id
,d.dealer_id
,a.account_no
,a.vin
,b.first_name
,b.last_name
,a.funded_date
,a.purchase_date
,a.miles
,a.duration
,a.sale_price
,a.sales_tax
,a.downpayment
FROM tDealer d
INNER JOIN tContact b ON d.contact_id = b.contact_id
INNER JOIN tContract a ON d.dealer_id = a.dealer_id
INNER JOIN tCompany c ON a.contract_id
WHERE c.program_id = 55
GROUP BY d.dealer_id
,account_no
,VIN
,first_name
,last_name
,funded_date purchase_date
,miles
,duration
,sale_price
,sales_tax
,downpayment
看看最後的加入。注意丟失了什麼? –
'加入tCompany c ON a.contract_id ='您需要以某種方式將a.contract_id連接到c。 –
爲什麼你在這個選擇中分組? – HLGEM