Is it possible to get multiple values from a subquery?

后端 未结 7 892
無奈伤痛
無奈伤痛 2021-02-06 22:49

Is there any way to have a subquery return multiple columns in oracle db? (I know this specific sql will result in an error, but it sums up what I want pretty well)



        
7条回答
  •  不要未来只要你来
    2021-02-06 23:22

    View this web: http://www.w3resource.com/sql/subqueries/multiplee-row-column-subqueries.php

    Use example

    select ord_num, agent_code, ord_date, ord_amount  
    from orders  
    where(agent_code, ord_amount) IN  
    (SELECT agent_code, MIN(ord_amount)  
    FROM orders   
    GROUP BY agent_code);    
    

提交回复
热议问题