SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Distinct records
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sunny_10
Yak Posting Veteran

72 Posts

Posted - 12/19/2012 :  09:51:39  Show Profile  Reply with Quote
Hi

I have 2 tables having field month . I want to display distinct months from the 2 tables

Table1 Table2
11 11
12 12
1 1
2

So the query should return 11,12,1,2

Thanks

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/19/2012 :  09:55:39  Show Profile  Reply with Quote
SELECT [month] FROM Table1 
UNION 
SELECT [month] FROM Table2;
Go to Top of Page

sunny_10
Yak Posting Veteran

72 Posts

Posted - 12/19/2012 :  10:00:42  Show Profile  Reply with Quote
Hi

I don't need to use distinct keyword

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 12/19/2012 :  10:04:15  Show Profile  Reply with Quote
where's distinct used in given suggestion?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000