Re: Re: INSERT a real number in a column based on other columns OLD INSERTs

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: litu16 <litumelendez(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: INSERT a real number in a column based on other columns OLD INSERTs
Date: 2015-06-25 23:25:04
Message-ID: 558C8DD0.1050609@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 25/06/15 16:06, litu16 wrote:
> SELECT t.time_index FROM table_ebscb_spa_log04 t WHERE t.fn_name =
> NEW.fn_name AND (t.time_type = 'Start' OR time_type = 'Lap') ORDER BY
> t.stmtserial DESC LIMIT 1 INTO t_ix;
Please format your SQL, as it makes it easier to read!
But, you don't have to follow my conventions, though. :-)

By formatting it, I noticed an apparent mistake (in this case,
functionally the same).
You had time_type = 'Lap' rather than t.time_type = 'Lap'.

SELECT
t.time_index
FROM
table_ebscb_spa_log04 t
WHERE
t.fn_name = NEW.fn_name
AND
(
t.time_type = 'Start'
OR
t.time_type = 'Lap'
)
ORDER BY
t.stmtserial DESC
LIMIT 1
INTO t_ix;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Johansen 2015-06-26 00:59:06 Re: Inserting from multiple processes?
Previous Message Adrian Klaver 2015-06-25 22:27:11 Re: Get the difference between two timestamp cells but in a special format in PostgreSQL