Received: from pc63.meskes.de (root@as11-asy67.rp-plus.de [149.221.93.195]) by hub.org (8.9.2/8.9.1) with ESMTP id BAA88349 for ; Fri, 26 Feb 1999 01:27:08 -0500 (EST) (envelope-from Michael.Meskes@gmx.net) Received: (from meskes@localhost) by pc63.meskes.de (8.9.3/8.9.3/Debian/GNU) id TAA01510; Thu, 25 Feb 1999 19:44:26 +0100 Date: Thu, 25 Feb 1999 19:44:26 +0100 From: Michael Meskes To: Margarita Barvinok Cc: PostgreSQL Interfaces Subject: Re: [INTERFACES]- SELECT statement Message-ID: <19990225194426.B1476@gmx.net> Mail-Followup-To: Margarita Barvinok , PostgreSQL Interfaces References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: ; from Margarita Barvinok on Thu, Feb 25, 1999 at 09:26:50AM -0500 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!