0

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 way to update based on the results of group by?.

1
  • your question is too hard to understand. please provide example input rows and an example of the desired output. and the query you already have. Commented Nov 2, 2009 at 16:09

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments