Bruno Wolff III wrote:
On Fri, Aug 20, 2004 at 23:40:08 +0700,
David Garamond <[EMAIL PROTECTED]> wrote:
Challenge question: is there a simpler way to do query #1 (without any
PL, and if possible without sequences too?
You could use a subselect to count how many countries had a lower
medal ranki
David Garamond <[EMAIL PROTECTED]> writes:
> This is not quite the same. The ranks are sequential, but they skip, so
> as to match the number of participating countries.
Oh, I missed that bit.
What you really want here is a "running sum" function, that is
SELECT running_sum(numranker) a
Tom Lane wrote:
Challenge question: is there a simpler way to do query #1 (without any
PL, and if possible without sequences too?
Can't without sequences AFAIK, but you certainly can do it simpler:
select setval('seq1', 0);
select nextval('seq1'), * from
(select count(*) as numranker,
gold, silve
On Fri, Aug 20, 2004 at 23:40:08 +0700,
David Garamond <[EMAIL PROTECTED]> wrote:
>
> Challenge question: is there a simpler way to do query #1 (without any
> PL, and if possible without sequences too?
You could use a subselect to count how many countries had a lower
medal ranking and add 1 to
David Garamond <[EMAIL PROTECTED]> writes:
> Challenge question: is there a simpler way to do query #1 (without any
> PL, and if possible without sequences too?
Can't without sequences AFAIK, but you certainly can do it simpler:
select setval('seq1', 0);
select nextval('seq1'), * from
(select c
See http://www.athens2004.com/en/OlympicMedals/medals?noc=MGL .
create table countrymedal (
countryid CHAR(3) PRIMARY KEY,
gold INT NOT NULL,
silver INT NOT NULL,
bronze INT NOT NULL);
COPY countrymedal (countryid, gold, silver, bronze) FROM stdin;
ITA 5 6 3
FRA 5
Hey,
I am exporting data from one database and importing into another
database. I dump the data from one database like so:
pg_dump dbname -R -a -f exportFile.sql
I then import the data using:
psql import_db -f exportFile.sql 1>>import_sql 2>>import_errorlog
However, when I do the import my imp
On Fri, 20 Aug 2004, Richard Huxton wrote:
> It'd be nice to say something like:
>
> ALTER TABLE status ADD CONSTRAINT user_status_fk
> FOREIGN KEY (status) WHERE relation = 'users'
> REFERENCES users(status);
>
> And the flip-side so you can have:
>
> ALTER TABLE cheque_details ADD CONSTRAINT chq
Josh Berkus wrote:
I have my own issue that forced me to use triggers. Given:
table users (
name
login PK
status
etc. )
table status (
status
relation
label
definition
PK status, relation )
the relationship is:
users.status =