pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feed[INTERFACES]- SELECT statement
3+ messages / 2 participants
[nested] [flat]
* [INTERFACES]- SELECT statement
@ 1999-02-25 14:26 Margarita Barvinok <brita@math.lsa.umich.edu>
1999-02-25 18:44 ` Re: [INTERFACES]- SELECT statement Michael Meskes <Michael_Meskes@topmail.de>
0 siblings, 1 reply; 3+ messages in thread
From: Margarita Barvinok @ 1999-02-25 14:26 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I have two questions.
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'
)
I used DECLARE CURSOR and FETCH for second SELECT statement.
But I don't know how to use WHERE ... IN clause.
2)
I need to create weekly report. I would like to ask users to enter just
one date (for example, Monday of the week).
How can I select information from database for a whole week?
Thank you
-Margarita
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [INTERFACES]- SELECT statement
1999-02-25 14:26 [INTERFACES]- SELECT statement Margarita Barvinok <brita@math.lsa.umich.edu>
@ 1999-02-25 18:44 ` Michael Meskes <Michael_Meskes@topmail.de>
1999-02-26 14:23 ` Re: [INTERFACES]- SELECT statement Margarita Barvinok <brita@math.lsa.umich.edu>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Meskes @ 1999-02-25 18:44 UTC (permalink / raw)
To: Margarita Barvinok <brita@math.lsa.umich.edu>; +Cc: pgsql-interfaces
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!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [INTERFACES]- SELECT statement
1999-02-25 14:26 [INTERFACES]- SELECT statement Margarita Barvinok <brita@math.lsa.umich.edu>
1999-02-25 18:44 ` Re: [INTERFACES]- SELECT statement Michael Meskes <Michael_Meskes@topmail.de>
@ 1999-02-26 14:23 ` Margarita Barvinok <brita@math.lsa.umich.edu>
0 siblings, 0 replies; 3+ messages in thread
From: Margarita Barvinok @ 1999-02-26 14:23 UTC (permalink / raw)
To: Michael Meskes <Michael_Meskes@topmail.de>; +Cc: pgsql-interfaces
Dear Michael,
Thank you very much.
-Margarita
On Thu, 25 Feb 1999, Michael Meskes wrote:
> 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!
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1999-02-26 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-25 14:26 [INTERFACES]- SELECT statement Margarita Barvinok <brita@math.lsa.umich.edu>
1999-02-25 18:44 ` Michael Meskes <Michael_Meskes@topmail.de>
1999-02-26 14:23 ` Margarita Barvinok <brita@math.lsa.umich.edu>
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