Brianwarnock
Retired
- Local time
- Today, 16:17
- Joined
- Jun 2, 2003
- Messages
- 12,667
No luck...
Should the WHERE clause that refers to the first INNER JOIN come before the second INNER JOIN?
No the From is all one clause, then the Where clause.
Brian
No luck...
Should the WHERE clause that refers to the first INNER JOIN come before the second INNER JOIN?
No the From is all one clause, then the Where clause.
Brian
If been musreading you code, I thought you had 3 tables with 1 joined to two.
Try
FROM DWP_F_DEALER_VEHICLE_INVENTORY,
(INNER JOIN DWP_D_VEHICLE_TYPE_APX ON
DWP_F_DEALER_VEHICLE_INVENTORY.VEHICLE_TYPE_SID
= DWP_D_VEHICLE_TYPE_APX.VEHICLE_TYPE_SID )
INNER JOIN DWP_D_DEALER ON
DWP_F_DEALER_VEHICLE_INVENTORY.DEALER_SID
= DWP_D_DEALER.DEALER_SID
I think Access automatically surrounds source tables with the [] characters. That may be why. What happens when u simply suppress the [] at the beg. and end of the outside FROM clause? I believe the error is referring to the OUTSIDE clause, not ne one of the inside ones...
So I was playing around with the placement of brackets in the FROM statement, and I tried to run the query and got a message saying something about DEALER_SID potentially belonging to more than one table... Was I missing something as silly as a rule that if the three tables share a field, it can't be used as the rule for an INNER JOIN?
After I got that, I thought that maybe in the SELECT statement of the first sub-query, I had better reference which table I wanted to pull DEALER_SID from, since it was just there by itself. I added the table reference to both sub-queries, and now I get a different error message... somthing about me not including the specified expression 'DEALER_SID' as part of an aggregate function.
This is getting annoying!
I think I may have come to a realization... I included DEALER_SID in the Select statement for no other reason that it is the field that the tables are joined on. I don't need to do that do I?
QUOTE]
Been there, done that, washed the &*&* off the T shirt.
Brian
SELECT * INTO [SALES_BY_ZONE]
FROM
[
SELECT 'RETAIL' AS TYPE,
Count(*) AS SALES,
Left([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],4) & ' ' & Mid([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],5,2) AS TRANSACTION_DATE,
[DWP_D_DEALER]![DEALER_ZONE_DESCRIPTION]
FROM DWP_F_DEALER_VEHICLE_INVENTORY
INNER JOIN DWP_D_VEHICLE_TYPE_APX ON
DWP_F_DEALER_VEHICLE_INVENTORY.VEHICLE_TYPE_SID=DWP_D_VEHICLE_T YPE_APX.VEHICLE_TYPE_SID
INNER JOIN DWP_D_DEALER ON
DWP_F_DEALER_VEHICLE_INVENTORY.DEALER_SID=DWP_D_DEALER.DEALER_S ID
WHERE DWP_F_DEALER_VEHICLE_INVENTORY.PROCESS_DATE_SID Between 20080101 And 20081231 And DWP_D_VEHICLE_TYPE_APX.SERIES_CD In (SELECT [19c1) vehicle_abbreviation_temp].VehicleAbbreviation FROM [19c1) vehicle_abbreviation_temp])
GROUP BY 'RETAIL',
[DWP_D_DEALER]![DEALER_ZONE_DESCRIPTION],
Left([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],4) & ' ' & Mid([DWP_F_DEALER_VEHICLE_INVENTORY].[PROCESS_DATE_SID],5,2)
UNION ALL
SELECT 'W/S' AS TYPE,
Count(*) AS SALES,
Left([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],4) & ' ' & Mid([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],5,2) AS TRANSACTION_DATE,
[DWP_D_DEALER]![DEALER_ZONE_DESCRIPTION]
FROM DWP_F_DEALER_VEHICLE_INVENTORY
INNER JOIN DWP_D_VEHICLE_TYPE_APX ON
DWP_F_DEALER_VEHICLE_INVENTORY.VEHICLE_TYPE_SID =
DWP_D_VEHICLE_TYPE_APX.VEHICLE_TYPE_SID
INNER JOIN DWP_D_DEALER ON
DWP_F_DEALER_VEHICLE_INVENTORY.DEALER_SID =
DWP_D_DEALER.DEALER_SID
WHERE DWP_F_DEALER_VEHICLE_INVENTORY.PROCESS_DATE_SID Between 20080101 And 20081231 And DWP_D_VEHICLE_TYPE_APX.SERIES_CD In (SELECT [19c1) vehicle_abbreviation_temp].VehicleAbbreviation FROM [19c1) vehicle_abbreviation_temp])
GROUP BY 'W/S',
[DWP_D_DEALER]![DEALER_ZONE_DESCRIPTION],
Left([DWP_F_DEALER_VEHICLE_INVENTORY]![PROCESS_DATE_SID],4) & ' ' & Mid([DWP_F_DEALER_VEHICLE_INVENTORY].[PROCESS_DATE_SID],5,2)
]. AS ZoneVehicleSales;