View Single Post
  #2  
Old June 1st, 2010, 09:45 PM posted to microsoft.public.access.queries
Krzysztof Naworyta
external usenet poster
 
Posts: 80
Default Union Query and Field Alias

SELECT "Before10" as TimeOfDay, * FROM [qryTodBefore10]
UNION ALL
SELECT "10To12", * FROM [qryTod10To12]
UNION ALL
SELECT "12To2", * FROM [qryTod12To2]
UNION ALL
SELECT "After2", * FROM [qryTodAfter2];

--
KN


Juzer SSi308 napisaƂ
| I have created a union query and now want to create a field alias to
| specify which records come from which query.
| The union query works as such:
| SELECT * FROM [qryTodBefore10]
| UNION
| SELECT * FROM [qryTod10To12]
| UNION
| SELECT * FROM [qryTod12To2]
| UNION
| SELECT * FROM [qryTodAfter2];
|
|
| But when I try to add the field alias I get the error: Syntax Error in
| From clause. The error is not any more specific than that. I have tried
| so many different statements I thought it may be better to just ask:
| What is the correct syntax to add a field alias called [TimeOfDay]?