On Wed, 21 Jul 2010 14:28:12 -0400, "jose isaias cabrera"
<[email protected]> wrote:
>
>Greetings and salutations.
>
>I believe this is possible, but I can not seem to get the syntax from the
>site. I have these 3 commands and 3 different steps that I want to put into
>one:
>
>1. result1 = SELECT sum(price) FROM table1 WHERE subProjID = 24;
>2. result2 = SELECT sum(price) FROM table2 WHERE ProjID = 8;
>3. BEGIN;
> UPDATE LSOpenSubProjects SET price = result1 WHERE subProjID = 24;
> UPDATE LSOpenSubProjects SET udate = now WHERE subProjID = 24;
> UPDATE LSOpenProjects SET price = result2 WHERE ProjID = 8;
> UPDATE LSOpenProjects SET udate = now WHERE ProjID = 8;
> END;
>
>How can I put all of these 3 steps into one?
BEGIN IMMEDIATE TRANSACTION;
UPDATE LSOpenSubProjects
SET
price = (
SELECT sum(price)
FROM table1
WHERE subProjID = 24
),
udate = julianday('now')
WHERE subProjID = 24;
UPDATE LSOpenProjects
SET
price = (
SELECT sum(price)
FROM table2
WHERE subProjID = 8
),
udate = julianday('now')
WHERE ProjID = 8;
COMMIT TRANSACTION;
(untested)
>thanks,
>
>josé
>
>_______________________________________________
>sqlite-users mailing list
>[email protected]
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
--
( Kees Nuyt
)
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users