agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: jj08 <jj08@drivehq.com>
To: vyegorov@gmail.com
To: jj08@drivehq.com
Cc: pgsql-sql@lists.postgresql.org
Subject: RE:Re: RE:Re: A complex SQL query
Date: Sat, 07 Sep 2019 19:09:45 -0700
Message-ID: <2261310231000000009736706@www> (raw)



Hello Vicor!

 It works!!!

 Thank you very much.

 

 
 
 
 --From: vyegorov@gmail.com
 --To: jj08@drivehq.com
 --CC: pgsql-sql@lists.postgresql.org
 --Date: 9/7/2019 2:33:40 PM --Subject: Re: RE:Re: A complex SQL query  сб, 7 сент. 2019 г. в 21:23, jj08 <<a href="mailto:jj08@drivehq.com">jj08@drivehq.com>:   

 To Janis or other members of the forum:

 
My sample table contains other columns as well.
 
 One of the columns that I did not include in my first message is &quot;position&quot;.
 The last table has been modified as follows:
 
 +--------+----------+------------+------------------------+
 | usr_id | employer | position   + start_date | end_date  |
 +--------+----------+------------+------------------------+
 | A      | Goo      | CTO        |            | 201904    |         
 | A      | Micro    | Mgr        | 201704     | 201903    |
 
 | B      | Micro    | Engg_Mgr   | 201706     | -         |
 | B      | Goo      | Researcher | 201012     | 201705    |
 | B      | Micro    | Postdoc    | 201001     | 201011    | +--------+----------+------------+------------------------+    
SELECT DISTINCT ON (usr_id)
        *
   FROM employment
  WHERE employer='Micro'  ORDER BY usr_id, start_date DESC;  
 --    Victor Yegorov   
 
 -------------------------
 Online Storage & Sharing, Online Backup, FTP / Email Server Hosting and More. 
 Drive Headquarters. Top quality services designed for business!  Sign up free at: www.DriveHQ.com
.  =

view thread (8+ messages)  latest in thread

Message-ID: <2261310231000000009736706@www>
Permalink:  ../2261310231000000009736706@www/
Also on:    postgresql.org/message-id/2261310231000000009736706@www

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jj08@drivehq.com, vyegorov@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: RE:Re: RE:Re: A complex SQL query
  In-Reply-To: <2261310231000000009736706@www>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox