<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Corelated Subquery ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948044#M760874</link>
    <description>&lt;!--!*#--&gt;Again (3rd time today!) a solution is suggested in the "SQL COOKBOOK"&lt;BR /&gt;Chapter 11, "Advanced Searching: Determining Which Rows Are Reciprocals"&lt;BR /&gt;&lt;A href="http://www.oreilly.com/catalog/sqlckbk/" target="_blank"&gt;http://www.oreilly.com/catalog/sqlckbk/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; drop table test;&lt;BR /&gt;Table dropped.&lt;BR /&gt;SQL&amp;gt; create table test (ColActual varchar(10), ColReplace varchar(10));&lt;BR /&gt;Table created.&lt;BR /&gt;SQL&amp;gt; set feedback off&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item2', 'Item6');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item3', 'Item10');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item1', 'Item4');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item6', 'Item9');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item11', 'Item14');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item4', 'Item1');&lt;BR /&gt;SQL&amp;gt; select * from test;&lt;BR /&gt;&lt;BR /&gt;COLACTUAL  COLREPLACE&lt;BR /&gt;---------- ----------&lt;BR /&gt;Item2      Item6&lt;BR /&gt;Item3      Item10&lt;BR /&gt;Item1      Item4&lt;BR /&gt;Item6      Item9&lt;BR /&gt;Item11     Item14&lt;BR /&gt;Item4      Item1&lt;BR /&gt;SQL&amp;gt; select distinct v1.* from test v1, test v2&lt;BR /&gt;  2    where v1.ColActual = v2.ColReplace&lt;BR /&gt;  3      and v2.ColActual = v1.ColReplace&lt;BR /&gt;  4&lt;BR /&gt;SQL&amp;gt; /&lt;BR /&gt;&lt;BR /&gt;COLACTUAL  COLREPLACE&lt;BR /&gt;---------- ----------&lt;BR /&gt;Item4      Item1&lt;BR /&gt;Item1      Item4&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;&lt;BR /&gt;note, this does NOT catch loops with more than 1 hop!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Tue, 20 Feb 2007 23:09:11 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2007-02-20T23:09:11Z</dc:date>
    <item>
      <title>Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948038#M760868</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to find particular column value(ColActual) and &lt;BR /&gt;get its replacement item (colReplace) AND &lt;BR /&gt;if ColReplace is available as ColActual&lt;BR /&gt;then i need to find the colReplace for that record and display it.&lt;BR /&gt;&lt;BR /&gt;For Example&lt;BR /&gt;&lt;BR /&gt;Sample data &lt;BR /&gt;&lt;BR /&gt;ColActual ----- ColReplace&lt;BR /&gt;Item1---------- Item4&lt;BR /&gt;Item4---------- Item10&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My output should be "Item 10" based on above sample data , because&lt;BR /&gt;1) First i will find Item 1 and find its replace which is Item4.&lt;BR /&gt;2) Then i'll check for Item4 in "ColActual" which is present , so then i will have to&lt;BR /&gt;get its ColReplace value which Item 10.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Problem.....&lt;BR /&gt;i have situations like following...check Item1 referring back to itself.&lt;BR /&gt;&lt;BR /&gt;ColActual ----- ColReplace&lt;BR /&gt;Item2---------- Item6&lt;BR /&gt;Item3---------- Item10&lt;BR /&gt;Item1---------- Item4&lt;BR /&gt;Item6---------- Item9&lt;BR /&gt;Item11---------- Item14&lt;BR /&gt;Item4---------- Item1&lt;BR /&gt;&lt;BR /&gt;My requirement now is to identify ONLY such recurrsive data.I need &lt;BR /&gt;both records in my output (if possible in ordered fashion).&lt;BR /&gt;For example , for the given data the output should be , &lt;BR /&gt;&lt;BR /&gt;ColActual ----- ColReplace&lt;BR /&gt;Item1---------- Item4&lt;BR /&gt;Item4---------- Item1&lt;BR /&gt;&lt;BR /&gt;Is this possible in one query. I cant write a procedure for this as i dont have access to create procedures. &lt;BR /&gt;&lt;BR /&gt;PLS HELP .. Thanks</description>
      <pubDate>Tue, 20 Feb 2007 11:27:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948038#M760868</guid>
      <dc:creator>uform</dc:creator>
      <dc:date>2007-02-20T11:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948039#M760869</link>
      <description>Hpux?&lt;BR /&gt;&lt;BR /&gt;Oracle?&lt;BR /&gt;&lt;BR /&gt;Flat-files?&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Feb 2007 12:35:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948039#M760869</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-20T12:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948040#M760870</link>
      <description>Sorry.. ORACLE</description>
      <pubDate>Tue, 20 Feb 2007 12:51:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948040#M760870</guid>
      <dc:creator>uform</dc:creator>
      <dc:date>2007-02-20T12:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948041#M760871</link>
      <description>Instead of using a correlated subquery try using inline tables.&lt;BR /&gt;&lt;BR /&gt;~cheers</description>
      <pubDate>Tue, 20 Feb 2007 13:37:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948041#M760871</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-02-20T13:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948042#M760872</link>
      <description>Can you please send me a sample of inline table usage. i'm new to Oracle.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 20 Feb 2007 13:42:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948042#M760872</guid>
      <dc:creator>uform</dc:creator>
      <dc:date>2007-02-20T13:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948043#M760873</link>
      <description>&lt;!--!*#--&gt;Posted below is a sample of inline table usage that you can tailor to your issue:&lt;BR /&gt;&lt;BR /&gt;select * from your_table yt,&lt;BR /&gt;(select ColActual from your_table) t1&lt;BR /&gt; where t1.ColActual = yt.ColReplace&lt;BR /&gt;/&lt;BR /&gt;&lt;BR /&gt;~hope it helps</description>
      <pubDate>Tue, 20 Feb 2007 13:59:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948043#M760873</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-02-20T13:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Corelated Subquery ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948044#M760874</link>
      <description>&lt;!--!*#--&gt;Again (3rd time today!) a solution is suggested in the "SQL COOKBOOK"&lt;BR /&gt;Chapter 11, "Advanced Searching: Determining Which Rows Are Reciprocals"&lt;BR /&gt;&lt;A href="http://www.oreilly.com/catalog/sqlckbk/" target="_blank"&gt;http://www.oreilly.com/catalog/sqlckbk/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; drop table test;&lt;BR /&gt;Table dropped.&lt;BR /&gt;SQL&amp;gt; create table test (ColActual varchar(10), ColReplace varchar(10));&lt;BR /&gt;Table created.&lt;BR /&gt;SQL&amp;gt; set feedback off&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item2', 'Item6');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item3', 'Item10');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item1', 'Item4');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item6', 'Item9');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item11', 'Item14');&lt;BR /&gt;SQL&amp;gt; insert into test values ( 'Item4', 'Item1');&lt;BR /&gt;SQL&amp;gt; select * from test;&lt;BR /&gt;&lt;BR /&gt;COLACTUAL  COLREPLACE&lt;BR /&gt;---------- ----------&lt;BR /&gt;Item2      Item6&lt;BR /&gt;Item3      Item10&lt;BR /&gt;Item1      Item4&lt;BR /&gt;Item6      Item9&lt;BR /&gt;Item11     Item14&lt;BR /&gt;Item4      Item1&lt;BR /&gt;SQL&amp;gt; select distinct v1.* from test v1, test v2&lt;BR /&gt;  2    where v1.ColActual = v2.ColReplace&lt;BR /&gt;  3      and v2.ColActual = v1.ColReplace&lt;BR /&gt;  4&lt;BR /&gt;SQL&amp;gt; /&lt;BR /&gt;&lt;BR /&gt;COLACTUAL  COLREPLACE&lt;BR /&gt;---------- ----------&lt;BR /&gt;Item4      Item1&lt;BR /&gt;Item1      Item4&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;&lt;BR /&gt;note, this does NOT catch loops with more than 1 hop!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 20 Feb 2007 23:09:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/corelated-subquery/m-p/3948044#M760874</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-20T23:09:11Z</dc:date>
    </item>
  </channel>
</rss>

