View Full Version : Missing Operator


doco
06-10-2008, 07:13 AM
Just need another set of eyes I guess. I keep getting 'missing operator' error on the following script

SELECT
p.id,
p.parcel_number,
pc.value as pclas,
hood.value as neighborhood,
p.alt_parcel_nr as map_lot
FROM
property p inner join
property_char pc ON
p.id = pc.property_id inner join
property_char hood ON
p.id = hood.property_id
WHERE
p.eff_to_date Is Null
and pc.prop_char_typ_code = 'PCLAS'
and hood.prop_char_typ_code = 'NBHD'
and pc.tax_year = ( select value from parameter where name = 'DEFAULT_TAX_YEAR' )
and hood.tax_year = pc.tax_year


The error states the missing operator is at 'property_char hood ON p.id = hood.property_id"

I guess my eyes are not what they used to be 'cause the script is pristine as far as I see...

Ideas?:confused:

TIA

MSAccessRookie
06-10-2008, 08:16 AM
I am not entirely sure what the intent of the query is, but the JOINS might be getting confused, and one of the following changes might get rid of the error:

SELECT
p.id,
p.parcel_number,
pc.value as pclas,
hood.value as neighborhood,
p.alt_parcel_nr as map_lot
FROM
( ( property p inner join
property_char pc ON
p.id = pc.property_id ) inner join
property_char hood ON
p.id = hood.property_id )
WHERE
p.eff_to_date Is Null
and pc.prop_char_typ_code = 'PCLAS'
and hood.prop_char_typ_code = 'NBHD'
and pc.tax_year = ( select value from parameter where name = 'DEFAULT_TAX_YEAR' )
and hood.tax_year = pc.tax_year

OR

SELECT
p.id,
p.parcel_number,
pc.value as pclas,
hood.value as neighborhood,
p.alt_parcel_nr as map_lot
FROM
( property p inner join
( property_char pc inner join
property_char hood ON
p.id = hood.property_id ) ON
p.id = pc.property_id)
WHERE
p.eff_to_date Is Null
and pc.prop_char_typ_code = 'PCLAS'
and hood.prop_char_typ_code = 'NBHD'
and pc.tax_year = ( select value from parameter where name = 'DEFAULT_TAX_YEAR' )
and hood.tax_year = pc.tax_year

doco
06-10-2008, 05:19 PM
That was it - a couple well placed parens. I keep forgetting Access is paren-oid. Copy/Paste from my SQL Server scripts is not always the easiest way. thanks :)

MSAccessRookie
06-10-2008, 05:44 PM
I am always glad to know that I have been able to share something that I have learned along the way.