Solved

SQL query from multiple tables.

Posted on 2008-06-16
2
723 Views
Last Modified: 2010-08-05
Greetings,
I have two views with identical data fields.  I want to select all the data from each and list them sequentially.  For example view1 has data field Order# with values 1,3,5,7.  View2 has Order# with values 2,4,6,8.  Is it possible to have a single select statement that produces a result set as Order# 1,2,3,4,5,6,7,8?  
0
Comment
Question by:mdunlap99
2 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 125 total points
ID: 21795679
select * from view1 v1
union all
select * from view2 v2
order by v1.fieldname asc
0
 
LVL 8

Expert Comment

by:i2mental
ID: 21795702
select field1 from table1
union all
select field1 from table 2
order by field1
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now