On 2/06, Richard Huxton wrote:
| You want to use triggers not rules here (see the "server programming" and
| "procedural language" manual sections). A trigger will be fired for each row
| inserted/deleted/updated. Of course this means it will be fired 5000 times
| for 5000 updated rows.
Ouch.
On Monday 02 Jun 2003 4:47 pm, Samuel Tardieu wrote:
> I have an "ips" table with 10+ records, each record having a
> "catid" field representing its category. "catid" references a row in a
> table called "categories".
>
> For statistics purpose (generation of images with the evolution of the
>
This is the solution I was looking for! 20 seconds to compile the whole
list.
Thanks everyone for your help, I very much appreciate it. Even though
this is kind of 'hackey' being that it's non-standard SQL, it keeps the
database from having to to 40,000 selects, as would have to do with any
corre
On Monday 02 June 2003 00:49, listrec wrote:
> How about:
>
> select max(transaction_id) from bank_account group by customer_id
>
And if you want the rest of the data in the rows:
SELECT b.*
FROM bank_account b
JOIN (
SELECT max(transaction_id) AS transaction_id
FROM bank_account
On Monday 02 June 2003 00:49, listrec wrote:
> How about:
>
> select max(transaction_id) from bank_account group by customer_id
>
And if you want the rest of the data in the rows:
SELECT b.*
FROM bank_account b
JOIN (
SELECT max(transaction_id) AS transaction_id
FROM bank_account
I have an "ips" table with 10+ records, each record having a
"catid" field representing its category. "catid" references a row in a
table called "categories".
For statistics purpose (generation of images with the evolution of the
number of rows by category), I am trying to reduce the load on t
Rado Petrik wrote:
Hi,
I have table users;
id name bin
--
1 xx 9
dec(1) & dec(9) = dec(1)
bin(0001) & bin(1001) = bin(0001)
This query is bad.
SELECT name FROM users WHERE id_user=1 AND (bin & 1)
This query return
"Warning: PostgreSQL query failed: ERROR: right-
I am afraid, this looks even uglier then your second solution, but
should work, and be quicker...
-- You need this to avoid having to rescan the whole table for each
customerid every time and resort the results
create index customer_txstamp_idx on bank_account (customer_id, ts);
select ba.* fro
"Erik G. Burrows" <[EMAIL PROTECTED]> writes:
> I need to get the most recent transaction for each customer. I need only
> the transaction ID, but the entire row would be best.
If you don't mind a not-standard-SQL solution, the SELECT DISTINCT ON
construct is designed for this sort of thing. See
Hi,
I have table users;
id name bin
--
1 xx 9
dec(1) & dec(9) = dec(1)
bin(0001) & bin(1001) = bin(0001)
This query is bad.
SELECT name FROM users WHERE id_user=1 AND (bin & 1)
This query return
"Warning: PostgreSQL query failed: ERROR: right- hand side of AND is
10 matches
Mail list logo