View Single Post
  #8  
Old June 2nd, 2010, 03:14 PM posted to microsoft.public.access.queries
SSi308
external usenet poster
 
Posts: 42
Default Union Query and Field Alias

Strange, I will need to try it again for my own curiosity. I tried this
syntax and did not have success, but it could be that there was some other
typo.

Thanks.
Lori

"Krzysztof Naworyta" wrote:

There's no difference between
SELECT "Before10" as TimeOfDay, * FROM ...
and
SELECT *, "Before10" as TimeOfDay FROM ...

--
KN


SSi308 wrote:
| Thank you for the reply, however, I did try this and it did not work.
| Refer to Karl Dewey's answer. The comma has to go after the *.
|
| Lori
|
| "Krzysztof Naworyta" wrote:
|
|| 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]?
||
|| .

.