<?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: Pull latest entry in table in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978754#M772586</link>
    <description>Something is wonky, because the last entry returns no results.&lt;BR /&gt;&lt;BR /&gt;But if I run this, I get 171 records returned.&lt;BR /&gt;&lt;BR /&gt;SELECT empid&lt;BR /&gt;  FROM v_emp&lt;BR /&gt; WHERE empid NOT IN (SELECT empid&lt;BR /&gt;                       FROM v_emphist&lt;BR /&gt;                      WHERE logon_time &amp;gt; SYSDATE - 90)</description>
    <pubDate>Mon, 15 May 2006 17:16:56 GMT</pubDate>
    <dc:creator>Ratzie</dc:creator>
    <dc:date>2006-05-15T17:16:56Z</dc:date>
    <item>
      <title>Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978748#M772580</link>
      <description>I have a script that sources two tables and pulls id's that have not logged in, in 90 days.&lt;BR /&gt;&lt;BR /&gt;SELECT empid&lt;BR /&gt;  FROM v_emp&lt;BR /&gt; WHERE empid NOT IN (SELECT empid&lt;BR /&gt;                       FROM v_emphist&lt;BR /&gt;                      WHERE logon_time &amp;gt; SYSDATE - 90)&lt;BR /&gt;&lt;BR /&gt;EMPID     &lt;BR /&gt;----------&lt;BR /&gt;BRIDER    &lt;BR /&gt;DFLINSTONE&lt;BR /&gt;DSMITH    &lt;BR /&gt;JREEVES  &lt;BR /&gt;4 rows selected&lt;BR /&gt;&lt;BR /&gt;What I would like to do is also pull the last login time along with the empid.&lt;BR /&gt;But...&lt;BR /&gt;v_emphist holds all login times.&lt;BR /&gt;I have two tables one holds the empid and other data, the other table holds empid and login times.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But the data looks like this:&lt;BR /&gt;emp_hist table&lt;BR /&gt;EMPID      LOGON_TIME             &lt;BR /&gt;---------- --------------------&lt;BR /&gt;ABACUS   5/5/2006 8:04:44 AM                  &lt;BR /&gt;ABACUS   5/4/2006 7:00:33 AM                    &lt;BR /&gt;ABACUS   5/3/2006 7:32:37 AM                   &lt;BR /&gt;ABACUS   5/2/2006 7:01:51 AM                   &lt;BR /&gt;ABACUS   5/1/2006 8:11:48 AM &lt;BR /&gt;ABOLES     4/26/2006 7:15:14 AM                  &lt;BR /&gt;ABOLES     4/25/2006 10:05:43 AM                &lt;BR /&gt;ABOLES     4/25/2006 8:40:18 AM                 &lt;BR /&gt;ABOLES     4/25/2006 8:06:53 AM&lt;BR /&gt;And so on for all id's</description>
      <pubDate>Fri, 12 May 2006 09:48:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978748#M772580</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-05-12T09:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978749#M772581</link>
      <description>Try this.&lt;BR /&gt;SELECT empid, max(b.logon_time)&lt;BR /&gt;FROM v_emp a, v_emphist b&lt;BR /&gt;WHERE a.empid NOT IN (SELECT empid&lt;BR /&gt;FROM v_emphist&lt;BR /&gt;WHERE logon_time &amp;gt; SYSDATE - 90)&lt;BR /&gt;and a.empid = b.emp_id&lt;BR /&gt;&lt;BR /&gt;Patti</description>
      <pubDate>Fri, 12 May 2006 09:59:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978749#M772581</guid>
      <dc:creator>Patti Johnson</dc:creator>
      <dc:date>2006-05-12T09:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978750#M772582</link>
      <description>I agree with Patti, but "NOT IN" runs slowly.&lt;BR /&gt;&lt;BR /&gt;Try this instead, it should run substantially faster.  &lt;BR /&gt;&lt;BR /&gt;SELECT empid, max(b.logon_time)&lt;BR /&gt;FROM v_emp a, v_emphist b&lt;BR /&gt;WHERE 0 = &lt;BR /&gt;(&lt;BR /&gt;SELECT count(*) &lt;BR /&gt;FROM v_emphist c&lt;BR /&gt;WHERE .empid = a.empid&lt;BR /&gt;AND logon_time &amp;gt; SYSDATE - 90&lt;BR /&gt;)&lt;BR /&gt;and a.empid = b.emp_id;</description>
      <pubDate>Fri, 12 May 2006 13:04:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978750#M772582</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-05-12T13:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978751#M772583</link>
      <description>I have reduced to bare script from one table and it complains with the first empid about not  a single group group function.&lt;BR /&gt;&lt;BR /&gt;SELECT empid, max(logon_time)&lt;BR /&gt;FROM v_emphist&lt;BR /&gt;WHERE 0 =&lt;BR /&gt;(&lt;BR /&gt;SELECT count(*)&lt;BR /&gt;FROM v_emphist&lt;BR /&gt;WHERE logon_time &amp;gt; SYSDATE - 90&lt;BR /&gt;)</description>
      <pubDate>Fri, 12 May 2006 13:27:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978751#M772583</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-05-12T13:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978752#M772584</link>
      <description>Try adding the bottom line like below:&lt;BR /&gt;&lt;BR /&gt;SELECT empid, max(logon_time)&lt;BR /&gt;FROM v_emphist&lt;BR /&gt;WHERE 0 =&lt;BR /&gt;(&lt;BR /&gt;SELECT count(*)&lt;BR /&gt;FROM v_emphist&lt;BR /&gt;WHERE logon_time &amp;gt; SYSDATE - 90&lt;BR /&gt;)&lt;BR /&gt;group by empid;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 May 2006 13:53:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978752#M772584</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-05-12T13:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978753#M772585</link>
      <description>Oh, I see you took out a join from the sub-select; you'll need to put it back otherwise, you'll not get the results you're wanting:&lt;BR /&gt;&lt;BR /&gt;Try the following:&lt;BR /&gt;&lt;BR /&gt;SELECT empid, max(logon_time)&lt;BR /&gt;FROM v_emphist a &lt;BR /&gt;WHERE 0 =&lt;BR /&gt;(&lt;BR /&gt;SELECT count(*)&lt;BR /&gt;FROM v_emphist b&lt;BR /&gt;WHERE b.empid=a.empid&lt;BR /&gt;AND logon_time &amp;gt; SYSDATE - 90&lt;BR /&gt;)&lt;BR /&gt;GROUP BY empid;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 May 2006 13:56:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978753#M772585</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2006-05-12T13:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978754#M772586</link>
      <description>Something is wonky, because the last entry returns no results.&lt;BR /&gt;&lt;BR /&gt;But if I run this, I get 171 records returned.&lt;BR /&gt;&lt;BR /&gt;SELECT empid&lt;BR /&gt;  FROM v_emp&lt;BR /&gt; WHERE empid NOT IN (SELECT empid&lt;BR /&gt;                       FROM v_emphist&lt;BR /&gt;                      WHERE logon_time &amp;gt; SYSDATE - 90)</description>
      <pubDate>Mon, 15 May 2006 17:16:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978754#M772586</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-05-15T17:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pull latest entry in table</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978755#M772587</link>
      <description>appreciate the help</description>
      <pubDate>Thu, 23 Nov 2006 21:39:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pull-latest-entry-in-table/m-p/4978755#M772587</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-11-23T21:39:11Z</dc:date>
    </item>
  </channel>
</rss>

