sql - Update query based on multiple criteria -


In Access 2007, I create an update query in a table to update the area_field based on the data of city_field Seeing. I have only data in city_field, only 13 cities and 5 regions - such as Middle, West, East, North and South, increase the table, I do not overwrite the previous field entries (I think if not tap then forward with the update Grow). This works fine when I have only one entry in the update box:

  update tblCustomers SET tblCustomers.region = "Central" WHERE (((TBL customers.office) = " LA "or (tblCustomers .office) =" SF "or (TBC customers .office) =" SD "));   

How do I add the rest of this statement and related cities?

Thank you.

Ideally, you should create an additional table that stores only the city and region provided by you Based on the things done, this table will currently only be 13 lines (one per office).

Then, you can do something like this:

  Update tblCustomers SET tblCustomers.region = (NEW_TABLE from top 1 NEW_TABLE.region, where NEW_TABLE.office = tblCustomers .office)   

The "Top 1" part only ensures that the subkey only gives one line, without this, the login query can not be liked. Of course, your Nudibel should have only one line per every office.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -