首页 > 解决方案 > 单列递归查询输出

问题描述

任何人都可以根据下面的表格数据帮助我解决下面的查询输出。

模式:AVRA1 与 979798 链接。现在在 979798 我们有(AVRA1,SHUBH2,MOM)。现在 SHUBH2 链接到 979798,979799。现在我需要检查 979799 并找出链接的 col2 等等。

表A

  col1  col2
979798  avra1
979798  shubh2
979798  mom
979798  shubh2
979799  shubh2
979799  papa
979799  papa
979800  papa
979800  neha
1   abc
2   xyz
3   asd
4   fgv
5   jug
6   iuy
7   oij
        

输入

AVRA1

输出

    col1    col2
    979798  avra1
    979798  shubh2
    979798  mom
    979799  shubh2
    979799  papa
    979800  papa
    979800  neha

标签: sqloracleoracle11grecursive-query

解决方案


If i look at your data, you are just selecting distinct records. Is that what are you expecting. If so use below query.

select distinct col1, col2 from table_name;

enter image description here

But not sure what is the use of TABLE B. What is the purpose of mentioning in the question?


推荐阅读