Solved

Combine two queries

Posted on 2011-09-19
3
335 Views
Last Modified: 2012-05-12
Thank you for looking at my question,

I have two queries:
'SELECT txtPartNo, intBar AS First, intOrdinal FROM tblPartsList WHERE intOrdinal = 1;'
and
'SELECT txtPartNo, intBar AS Second, intOrdinal FROM tblPartsList WHERE intOrdinal = 2;'


How do I combine the query to end up with three columns - txtPartNo. First and Second

Thank you
0
Comment
Question by:Crxfrd
[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
3 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 36559114

select txtPartNo,First, Second from

(

SELECT txtPartNo, intBar AS First, intOrdinal FROM tblPartsList WHERE intOrdinal = 1
union
SELECT txtPartNo, intBar AS Second, intOrdinal FROM tblPartsList WHERE intOrdinal = 2

)
a
0
 
LVL 15

Expert Comment

by:Haris Djulic
ID: 36559121
or like this


SELECT txtPartNo, intBar AS First, intOrdinal FROM tblPartsList WHERE intOrdinal in ( 1,2)
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36559137
try this

SELECT txtPartNo, intBar AS First, intOrdinal FROM tblPartsList WHERE intOrdinal = 1 OR 2

try this

SELECT txtPartNo, intBar AS First, intOrdinal FROM tblPartsList WHERE intOrdinal = 1 OR intOrdinal = 2
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
SQL Query logic question 14 71
Looking for advice on how to develop a project database 2 48
MS Access query 16 61
Combo box question 6 55
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

738 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