Solved

SQL query from multiple tables.

Posted on 2008-06-16
2
763 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

726 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