troubleshooting Question

Updating a table where the where clause includes "sum" of another column

Avatar of swsbuyer
swsbuyer asked on
DatabasesMySQL ServerSQL
2 Comments1 Solution310 ViewsLast Modified:
I have two tables:

TB1: Has the population of cities. Multiple cities in a state.
    int population
    varchar city
    varchar state (FK)

   varchar state (PK)
   int status

Now I need to run queries that do the following:

1) Set the column TB2.status = 1 if the population of a state > 1 million
2) Delete records from TB2 where population of state < 100,000

Can you point me in the right direction.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros