The query you gave in the answer Consolidate data on multiple rows into one (01 August 2003) is not working in...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
MS Access 2002. Can you please tell me why?
There are three differences in syntax that need to be made so that you can run the query in MS Access.
First, the CASE constructions must be rewritten with IIF functions:
select Name , IIF(Food='Fruit','Fruit','') as Fruit , IIF(Food='Banana','Banana','') as Banana , IIF(Food='Bread','Bread','') as Bread , IIF(Food='Pizza','Pizza','') as Pizza from yourtable
Next, MS Access does not support derived tables. Well, it didn't in earlier versions, and I have not tested Access 2002, but in any case, there's a workaround. Just save the above query as query ZZZ (or some other name), and then you can use it in the FROM clause.
Finally, concatenation in Access is different, and uses the ampersand. (Access 97 gives the error message "Invalid use of vertical bars" which always struck me as hilarious. I mean, if it's smart enough to recognize them as vertical bars, why doesn't it just do the concatenation? The double vertical bars or pipes are the standard SQL concatenation operator.)
So the query becomes:
select Name , max(Fruit) & ' ' & max(Banana) & ' ' & max(Bread) & ' ' & max(Pizza) as Food from ZZZ group by Name
Dig Deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.