Retrieve Value from SQLITE Table and use to query another table.Inserting rows in to a table using WHERE condition and JOIN from another table in SQLite.How can I UPDATE table using condition WHERE from another table in SQLite.insert into 2 table one linked to the second through FOREIGN KEY and take data from another table in sqlite and python.C# WPF and Sqlite: Datagrid displays last table recording when trying to read from an sqlite database table.Update row with data from another row in the same table in SQLite.Update table using join and conditions(where) from another table.Android How to UPDATE an SQLite table from another table using GROUP BY.SQLite select and count from another table with like.SQLite update data from one table to another.Insert or Update values into original table with values from another table in SQLite.SQLite Update a column from one table using another table. SQLite unable to update data from another table.SQLite update field with count from another table.SQLITE UPDATE field IF NULL from another table.How to get all columns from one table and one column from another table in SQLITE.Getting "Database is Locked" when trying to move a list of records from one table to another table in SQLite.SQLite inner join - update using values from another table.Using INSERT and UPSERT in SQLite trigger to update one table from another table?.SQLite select average from one table and update average field from another table using trigger.Update multiple rows with values from another table and where clause in SQLite.SQLite Copy Table Content from one Table to another Table and Update.I am trying to update an SQLIte table from another table and my Syntax seems to be wrong.it has not bee tested so it may contain errorsĪs per your comment you wanted a less complex query as per :- String updatePack = "UPDATE FP_Master SET TakeAwayPkCost = (SELECT Pack_Cost FROM Take_Away_Pack_Details WHERE Pack_Type = TakeAwayPkType)".rather it attempts to clarify the syntax that could be used.it doesn't necessarily reflect the results you want as this cannot be determined." ) " + //<<<<<<<<<< CLOSE PARENTHESIS FOR SUB-SUBQUERY " WHERE " + COLUMN_PACK_TYPE + " = " + COLUMN_TAKEAWAY_PK_TYPE + " AND EXISTS " + //<<<<<<<<<< AND INSTEAD OF WHERE and EXISTS INSTEAD OF EXISTS " WHERE " +COLUMN_PACK_TYPE+" = " + COLUMN_TAKEAWAY_PK_TYPE + " SET " + COLUMN_TAKEAWAY_PK_COST + " = ( " + //<<<<<<<<<< OPEN PARENTHESIS FOR SUBQUERY So the above could be :- String updt = "UPDATE " + TABLE_NAME4 + SQL As Understood By SQLite - expression.The third issue is that EXIST is not a keyword it is EXISTS. A subquery needs to be enclosed in parenthesises ( at the start and ) at the end. The second issue is that you then try to use a subquery. WHERE result_of_expression AND result_of_the_other_expression WHERE expects a result of true or false (1 or greater or 0) from an expression, you can use AND or OR to get a result of true or false from two results so you should be using WHERE result_of_expression AND result_of_the_other_expression The first is that you have two WHERE clauses when you can only have one (although there can be a where clause within a subquery).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |