Solved

Sql select inner query column

Posted on 2014-09-03
2
159 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 500 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 26

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

809 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