pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Edstrom <edstrom@Poopsie.hmsc.orst.edu>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] locked my keys in the car
Date: Mon, 3 Aug 1998 11:54:31 -0700
Message-ID: <199808031854.LAA03398@Poopsie.hmsc.orst.edu> (raw)



> 
> And so I tried this here:
> 
> SELECT tr_id, tr_date FROM crtrd1
> WHERE tr_unit = 'SMA' AND (tr_type = 'A' OR tr_type = 'I')
> AND tr_date > tr_date IN
> (SELECT tr_date FROM crtrd1
> WHERE tr_unit = 'SMA' AND (tr_type = 'T' OR tr_type = 'O'))
> ORDER BY tr_date DESC;
> 



How about

CREATE FUNCTION F(int,char) returns int4 as 
       'SELECT max(tr_date) FROM crtd1 
        WHERE $1=tr_id
	      AND  $2=tr_unit
	      AND (tr_type = \'A\' OR 
	           tr_type = \'I\');'
    language 'sql';


and then search as:

SELECT distinct tr_id,F(tr_id) from crtd1;







view thread (9+ messages)  latest in thread

Message-ID: <199808031854.LAA03398@Poopsie.hmsc.orst.edu>
Permalink:  ../199808031854.LAA03398@Poopsie.hmsc.orst.edu/
Also on:    postgresql.org/message-id/199808031854.LAA03398@Poopsie.hmsc.orst.edu

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: edstrom@Poopsie.hmsc.orst.edu
  Subject: Re: [SQL] locked my keys in the car
  In-Reply-To: <199808031854.LAA03398@Poopsie.hmsc.orst.edu>
  References: <199808031854.LAA03398@Poopsie.hmsc.orst.edu>

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

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