Solved

T-SQL Union queries

Posted on 2008-10-16
2
459 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
[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
 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 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