Link to home
Start Free TrialLog in
Avatar of Roman F
Roman FFlag for United States of America

asked on

Help with the union query

I have a union query.
Select * from T1
union
select * from T2

The result will will be like this:
40
4

Fine, the query is working

What i want:

I need to see results like that

40
----
4

meaning i need to see three rows of data and the middle one should be "---"

i was trying to do something like
Select * from T1
union
select "---" from T1
union
select * from T2
does not work, need help
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The numbers in the 2nd column determine the Sort Order.

ORDER BY 2  means to order by the 2nd column,

mx
Avatar of Roman F

ASKER

Thank you for an idea,


Select 1,  * from T1
union
Select 2,"" from T1
union
select 3,* from T2

you do not need even any other temp tables, works great


My tables have only one field, that is why i use *