Hello again,
I think I can simplify the actual question:
Can I use a SELECT returning multiple rows as input to some INSERT
logic, and in that logic INSERT into multiple tables?
Like if I have a table t1 containing id 1, 2, 3.
For each id in t1, do
INSERT INTO t2 (...)
INSERT INTO t3 (...) --B
Den 2015-09-24 kl. 13:03, skrev Simon Slavin:
> On 24 Sep 2015, at 11:38am, Daniel Polski wrote:
>
>> -- Here is where my real question starts. Can I fetch a list of rows in a
>> trigger
>> -- and update different tables from that data?
> Create a VIEW which does this
>
> SELECT ... FROM t1 JOIN
Hello!
--Table t1 contains some "base" data
CREATE TABLE t1 (
idINTEGER PRIMARY KEY,
name VARCHAR(10),
value INT NOT NULL
);
INSERT INTO t1 VALUES(1, 't1 1', 0);
INSERT INTO t1 VALUES(2, 't1 2', 0);
--Table t2 can contain extra data for a row in table t1
CREATE TABLE t2(
On 24 Sep 2015, at 11:38am, Daniel Polski wrote:
> -- Here is where my real question starts. Can I fetch a list of rows in a
> trigger
> -- and update different tables from that data?
Create a VIEW which does this
SELECT ... FROM t1 JOIN t2 ON t2.t1_id = t1.id
Then set the triggers for the V
Excerpts from Daniel Polski's message of 2015-09-24 09:50:36 -0300:
>
> Hello again,
> I think I can simplify the actual question:
>
> Can I use a SELECT returning multiple rows as input to some INSERT
> logic, and in that logic INSERT into multiple tables?
That was exactly what I showed you us
Excerpts from Daniel Polski's message of 2015-09-24 07:38:24 -0300:
> Hello!
>
> --Table t1 contains some "base" data
> CREATE TABLE t1 (
> idINTEGER PRIMARY KEY,
> name VARCHAR(10),
> value INT NOT NULL
> );
>
> INSERT INTO t1 VALUES(1, 't1 1', 0);
> INSERT INTO t1 VALUES(2, '
6 matches
Mail list logo