pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Meskes <Michael_Meskes@topmail.de>
To: Margarita Barvinok <brita@math.lsa.umich.edu>
Cc: PostgreSQL Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: [INTERFACES]- SELECT statement
Date: Thu, 25 Feb 1999 19:44:26 +0100
Message-ID: <19990225194426.B1476@gmx.net> (raw)
In-Reply-To: <Pine.SOL.3.96-4hack.990224134002.12574D-100000@sewerurchin.math.lsa.umich.edu>
References: <Pine.SOL.3.96-4hack.990224134002.12574D-100000@sewerurchin.math.lsa.umich.edu>

On Thu, Feb 25, 1999 at 09:26:50AM -0500, Margarita Barvinok wrote:
> 1)
>  How can I realize this query in C-Embedded SQL?
> 
> SELECT MAX (score)
>   FROM report
>   WHERE uname = 'xxxxxxx'
>   AND exam_id IN
>       ( SELECT exam_id 
>         FROM exam
>         WHERE name = 'yyyy'
>       )

exec sql declare C cursor for  SELECT MAX (score)
   FROM report
   WHERE uname = 'xxxxxxx'
   AND exam_id IN
       ( SELECT exam_id
         FROM exam
         WHERE name = 'yyyy'
       );

exec sql fetch in C into :score;

> I used DECLARE CURSOR and FETCH for second SELECT statement.
> But I don't know how to use WHERE ... IN clause.

This is one statement. The subselect is handled by the backend.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!



view thread (3+ messages)  latest in thread

Message-ID: <19990225194426.B1476@gmx.net>
Permalink:  ../19990225194426.B1476@gmx.net/
Also on:    postgresql.org/message-id/19990225194426.B1476@gmx.net

 · 

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-interfaces@postgresql.org
  Cc: Michael_Meskes@topmail.de, brita@math.lsa.umich.edu
  Subject: Re: [INTERFACES]- SELECT statement
  In-Reply-To: <19990225194426.B1476@gmx.net>

* 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