Solved

T-SQL Union queries

Posted on 2008-10-16
2
453 Views
Last Modified: 2012-05-05
Hello,
I have 2 tables in Sql server 2005.
t1 with 9675 record
t2 with 777 record

If i execute a query on t1, let's say q1, it returns 9472 records
and if i execute another one, q2 on t2 i have only 2 records returned.

the 2 queries have the same schema, so i execute them in a union quey, only 9273 records are returned,

Can someone tell me what's happening here, please ????
thanks
0
Comment
Question by:Nyana22
2 Comments
 

Author Comment

by:Nyana22
ID: 22734979
why it's 9273 and not 9472+2 = 9474, so there is some missing records!!
0
 
LVL 12

Accepted Solution

by:
Einstine98 earned 350 total points
ID: 22734981
Use union ALL

select Q1
union All
select Q2

also post your qury for better understanding of your problem and consequently help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based developeā€¦
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Itemsā€¦

758 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

19 Experts available now in Live!

Get 1:1 Help Now