John Machin wrote:
>
> On 17/05/2009 1:35 AM, velkropie wrote:
>> Hello,
>>
>> I'm trying to update two tables with one statement but, i'm not getting
>> something right. can someone here help me , or guide me to the right
>> place
>> to get help?
>>
>> Thanks
>>
>> "UPDATE funrecipes, ingredients SET funrecipes.recipetitle,
>> funrecipes.copyright, funrecipes.directions, ingredients.ingredient_name
>> WHERE ingredients.pk = funrecipes.pk"
>>
>> this is returning a database error, any ideas?
>
> A "database error"? Nothing to do with a database, it's just not valid
> SQL. Read this: http://www.sqlite.org/lang_update.html
>
> There are _*TWO*_ syntax problems with your UPDATE statement:
> (1) it is not possible to update more than one table in the same UPDATE
> statement
> (2) you don't say *what* each column must be set to ... the syntax is
> SET column_name1 = expression1, column_name2 = expression2, ...
>
> And possibly one logic problem ... your WHERE clause would look a bit
> suss even in a SELECT statement, especially if "pk" means "primary key".
>
> HTH,
> John
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
i'm sorry for not placing more information, and thanks for your help.
the application has two tables.
recipes tables has the following fields:
pk which is the primary field and autoincrements
directions
copyright
another table call ingredients
ingredient_name
ingredient_id(pk)
pk (which i was hoping to tie to recipes, since pk is the (pk) for recipes)
since i plan to have many ingredients display at once i decided to set it in
another table.
the fields will be updated by user imput
--
View this message in context:
http://www.nabble.com/Updating-two-tables-rows-in-one-sql-statement-tp23574927p23579117.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users