问题
As per another question, sql: update a column if another column poses a conflict in namespace, we know that the following could be used to ensure that a set of 10000 unique package names and 100 categories, having 15000 unique combinations (thus table entries in table categories
), could be updated to ensure that the two namespaces don't collide with one another (affecting about 10 entries in total):
UPDATE categories
SET fullpkgpath = fullpkgpath || ',pkg'
WHERE fullpkgpath IN (SELECT value
FROM categories)
However, the fullpkgpath
field also repeats in other tables within my sqlite3 database, as per the schema.
Is there a way to have the above
UPDATE
statement applied to all other tables within a given sqlite3 database with the samefullpkgpath
field, without having to manually specify any such extra tables?- If the answer to be above is, "no", then how would I manually specify which other tables I want the statement applied to? Consider that only the
categories
table has the categories that could be directly compared with names of packages (to be fair, theports
table also has acategories
field, but it has all the categories of a given port jammed into one field (space separated), as opposed to separate table entries as is the case in thecategories
table).
- If the answer to be above is, "no", then how would I manually specify which other tables I want the statement applied to? Consider that only the
来源:https://stackoverflow.com/questions/21195043/sql-update-a-given-field-in-all-tables-instead-of-just-one-table