Solved

Sql select inner query column

Posted on 2014-09-03
2
175 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
[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 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

632 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