Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SQL Query Problem

Posted on 2012-08-22
4
Medium Priority
?
885 Views
Last Modified: 2012-08-22
I have a query where I am trying to update a field to the new fiscal year with the matching field from the old fiscal year.   It looks like this but it does not work.  Any ideas?

UPDATE [SELECT Mgr, PSINO, FiscalYear FROM PartForecast WHERE FiscalYear=2013; ] AS A INNER JOIN [SELECT Mgr, PSINO, FiscalYear FROM PartForecast WHERE FiscalYear=2012; ] AS B ON A.PSINO=B.PSINO SET A.Mgr = B.Mgr;
0
Comment
Question by:submarinerssbn731
  • 3
4 Comments
 

Author Comment

by:submarinerssbn731
ID: 38320395
Basically what I am trying to do is match the Manager field (Mgr) to the PSI part number (PSINO) they are responsible for from fiscal year 2012 to 2013.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 38320570
lets see if i understood it correctly..

update PartForecast as A inner join PartForecast as B
on A.PSINO=B.PSINO
set A.Mgr=B.Mgr
where A.FiscalYear=2013 and B.FiscalYear=2012
0
 

Author Comment

by:submarinerssbn731
ID: 38320576
That is correct.
0
 

Author Closing Comment

by:submarinerssbn731
ID: 38320601
Great Answer!  Worked like a champ!!!  Thanks!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question