Reputation: 1
select o.*,x.cust_name from(
select cust_name from customer c where salesman_id IN(
select salesman_id from Orders o where ord_date ='2012-08-17'))x
I only got customer names but i need order columns also. i want solution in subquery
ord_no | purh_amt | ord_date | cust_id | salesman_id | cust_name |
---|---|---|---|---|---|
70011 | 75.29 | 2012-08-17 | 3003 | 5007 | jozy |
7004 | 110.5 | 2012-08-17 | 3009 | 5003 | geoff |
Upvotes: 0
Views: 38
Reputation: 54
if i understand what you want to achieve you need a inner join like so :
select ord_no,cust_name,ord_date
from customer c
inner join orders o
on (c.salesman_id = o.salesman_id)
where o.ord_date = '2012-08-17';
Upvotes: -1