Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sql select inner query column

Posted on 2014-09-03
2
Medium Priority
?
184 Views
Last Modified: 2014-09-03
How can I display a column from a inner query?

Select ordered from table orders where exists
(Select date from order history where .... )

I want to display the ordered and date.
0
Comment
Question by:hojohappy
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 40301963
In that case you need a inner join

Select ordered, date
from TableOrders o
Inner join orderHistory h on h.orderId = o.orderID
0
 
LVL 27

Expert Comment

by:Shaun Kline
ID: 40301964
You would need to include both tables in the from clause:
Select orders.ordered, orderhistory.date
from table orders
inner join orderhistory on orders.<pk column> = orderhistory.<fk column> 

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

772 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