Is it possible to Update single/multiple columns using "group by"
I am running group by on 4 columns of two tables. I have unique ID column in two tables. I want to mark both the tables occurrences column to SINGLE/MULTIPLE based on the 4 columns. Is there any w开发者_C百科ay to update based on the results of group by?.
As longneck noted, your description is pretty vague.
However, to answer your question generally, it IS possible to run an update based on the results of another query:
UPDATE your_update_table
FROM your_update_table
JOIN
(
# Insert your query (with GROUP BYs and all) here
) AS subquery_join ON subquery_join.id = your_update_table.id
SET your_update_table.column = subquery_join.some_value
A more explicit answer would require a more detailed explanation of the problem.
精彩评论