02-10-15, 01:00 #1Registered User
- Join Date
- Mar 2004
Unanswered: Syntax error (missing operator) in query expression
This worked with just one city, however I need to be able to place multiple city abbreviations (as many as 15 sometimes) in this query. Wow-it would be great if I could sum the count number for each city?
SELECT TblCRMLS_CLOSED_STATS.City, TblCRMLS_CLOSED_STATS.DateClosedSale, TblCRMLS_CLOSED_STATS.ListPriceOriginal, TblCRMLS_CLOSED_STATS.ListPriceLow, TblCRMLS_CLOSED_STATS.SellingPrice FROM TblCRMLS_CLOSED_STATS WHERE (((TblCRMLS_CLOSED_STATS.City)="cdm" OR (TblCRMLS_CLOSED_STATS.City)="cdc" AND ([TblCRMLS_CLOSED_STATS.ListPriceOriginal])>[TblCRMLS_CLOSED_STATS.SellingPrice])) GROUPBY TblCRMLS_CLOSED_STATS.City)ASC;
Last edited by Missinglinq; 02-10-15 at 20:54. Reason: Correcting 'code' formatting.
02-10-15, 02:14 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
Be wary of brackets...
...not least because the Access query designer loves them to bits and inserts thrm willy nilly making the sql look more complex than it is.
Having said that I suspect your syntax error is probably an extra ) in the group by clause.
your where clause indicates to me you dont seem to have grasped the purpose of the brackets. Use them to group together or isolate logical expressions. What i think you want is (city = cdm or city = cdc) and listprice > Sellingprice
If you want multiple examples of the same column then consider using the in construct
where city in ('cdm', 'cdc') and......I'd rather be riding on the Tiger 800 or the Norton