【问题标题】:I want order details also like order columns我还想要订单详细信息,例如订单列
【发布时间】:2022-11-23 10:50:19
【问题描述】:
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 

我只有客户名称,但我还需要订单列。我想在子查询中解决

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

【问题讨论】:

    标签: sql sql-server-2005


    【解决方案1】:

    如果我理解你想要实现的目标,你需要像这样的内部连接:

    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';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      • 2015-01-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2016-05-14
      相关资源
      最近更新 更多