On Tue, 2 Jun 2009 03:36:46 -0700 (PDT), robinsmathew
<[email protected]> wrote:
>
>hey thanx for the reply... u leave the things happening inside.. wat i jus
>wanna do is i wanna insert a new row to a table
>the table will be like this
>stock_id PK product_id FK quantity stock_date
>10000 1000 10 28-05-2009
>10001 1001 5 27-05-2009
>
>and wen i insert a new row with values NULL, 1000, 15, 30-05-2009
>
>i dont want want it as a new recorde i jus want to update the first row coz
>its also having the same product id i jus want set the quantity = 10+15 and
>the date new date that is 30-05-2009
>and suppose if i insert row with different product_id it should be inserted
>as it is..
Pseudocode:
BEGIN;
UPDATE stock_tab SET ..... WHERE stock_id = 10000;
if sqlite_error()
INSERT INTO stock_tab SET (...) VALUES (...);
endif
COMMIT;
--
( Kees Nuyt
)
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users