From: | kvnsmnsn(at)cs(dot)byu(dot)edu |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | including limited lines depending on input parameter |
Date: | 2007-04-27 16:10:38 |
Message-ID: | 37084.67.137.192.66.1177690238.squirrel@mail.cs.byu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hello all,
Okay, this is me back again regarding those two tables I needed
to join again, <abc> and <def>. Once these tables are joined together
the resulting table has two fields of interest, <n> and <p>. There
can be multiple <p> values for one <n> value. I have an input parame-
ter <i> that can have three values, 1, 2, or 3+. Based on <i> I need
to include in the output table either one <p> value for each <n> va-
lue (as far as I know chosen at random) if one exists, two <p> values
for each <n> value (again chosen at random) if two exist, or all <p>
values for each <n> value, respectively.
Does anyone know how I would go about generating such an output
table?
I have a book _Practical PostgreSQL_ that I thought would help me
figure out how to do this (since my SQL server is PostgreSQL), but so
far it has been no use. Any information on this would be greatly ap-
preciated.
---Kevin Simonson
"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2007-04-27 19:54:30 | Re: removing duplicate entries in a <JOIN> statement |
Previous Message | kvnsmnsn | 2007-04-27 15:18:59 | removing duplicate entries in a <JOIN> statement |