Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MS SQL 2005 merge data.

Posted on 2011-04-25
6
Medium Priority
?
484 Views
Last Modified: 2012-05-11
A = 1
B = 3

select * from myTable where myColumn = A.
--> return 2 record:
0.080
0.097


select * from myTable where myColumn = B
--> return 1 record:
0.234


How can I merge them into 1 data table:
0.080
0.097
0.234

I don't want to use this query:
select * from myTable where myColumn = A or myColumn = B.

Please help me.

0
Comment
Question by:JameMeck
6 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 35464698
You can use IN:
select * from myTable where myColumn in (A, B)

If you do not mind me asking, why you do not want to use AND?
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35464701
I meant OR
0
 
LVL 10

Accepted Solution

by:
Asim Nazir earned 1000 total points
ID: 35464709
Yes. Or will work fine. Otherwise you can use Union like:

select * from myTable where myColumn = A
Union
select * from myTable where myColumn = B

Oring approach is better in your scenario.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 1000 total points
ID: 35464716
select * from myTable where myColumn = A.
Union
select * from myTable where myColumn = B
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35465023
select * from myTable where myColumn in (A,B).
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35465072
>I don't want to use this query:
why not?

you might want to read this article:
http://www.experts-exchange.com/A_1536.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
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.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2

572 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