How about:
select max(transaction_id) from bank_account group by customer_id
Should work...
Detlef
-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Auftrag von Erik G. Burrows
Gesendet: Montag, 2. Juni 2003 07:30
An: [EMAIL PROTECTED]
Betreff: [SQL] SQL problem
On Friday 30 May 2003 7:01 pm, C F wrote:
> I was afraid someone was going to ask that :)
> Okay, I'll do my best at explaining where I'm coming from
[snip long but detailed description I asked for -thanks]
Right - I've done something similar to this before, and I ended up building my
SQL on
> It seems to me this is a simple problem, but the solution eludes me.
>
> I have a table:
>
> bank_account (
> transaction_id int not null serial,
> customer_id int not null references customer(id),
> ts timestamp not null default now(),
> amount float not null,
> balance float not null
> I need to get the most recent transaction for each customer. I need only
> the transaction ID, but the entire row would be best.
>
Why don't you alter the customer table to hold the transaction ID of the most
recent transaction?
Some questions though:
Do you vacuum the database regularly?
It seems to me this is a simple problem, but the solution eludes me.
I have a table:
bank_account (
transaction_id int not null serial,
customer_id int not null references customer(id),
ts timestamp not null default now(),
amount float not null,
balance float not null,
primary key(tra
Avi,
> I understand why it will not be implemented with overloaded functions.
> Is there a possibility to allow this only for functions that are not
> overloaded?
Unfortunately, no. There's simply no way for the database to tell the
difference between a function call relying on defaults, and
Walid,
> I am searching for big industrial project using PostgreSQL as a database
> system manager. Can anyone give references or bibliograpghy other than
> the official postgres site?
advocacy.postgresql.org
We're working on a case study section, but it's not ready yet. The biggest I
can men
On Sunday, Jun 1, 2003, at 10:46 America/Chicago, Tom Lane wrote:
Rod Taylor <[EMAIL PROTECTED]> writes:
thing that causes me some minor grief is the fact that currently
you=20
cannot have default values to function parameters, a feature we use
a=20
lot.
fn(integer, integer, integer default 32)
Rod Taylor <[EMAIL PROTECTED]> writes:
>> thing that causes me some minor grief is the fact that currently you=20
>> cannot have default values to function parameters, a feature we use a=20
>> lot.
> fn(integer, integer, integer default 32)
> select fn(integer, integer); <- Third argument would be
Exactly. It is used with named parameters when the parameter is not
provided.
Avi
On Sunday, Jun 1, 2003, at 07:21 America/Chicago, Rod Taylor wrote:
thing that causes me some minor grief is the fact that currently you
cannot have default values to function parameters, a feature we use a
lot.
10 matches
Mail list logo