var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Update Query
I am trying to do an update query in MS Access using SQL
I have two tables Employees and Salaries.
Emp ID PK
Emp Id PK
I am trying to update the salary figure from the Salaries table into the employee table using sql. How would I do this?
Re: Update Query
On Oracle I would do:
update employees e
set salary = (select salary from salaries s where s.emp_id = e.emp_id)
where emp_id in (select emp_id from salaries);
The final WHERE clause is to prevent overriding existing salary values with NULL where no matching salaries row exists. Omit the WHERE clause if that is what you would want to do.
No Joy it told me to use an updatable query (which I had done!)
joined update syntax varies from database to database
in sql server, it's
whereas in access it's
set fldx = t2.fldy
from table1 t1
join table2 t2
on t1.keyfld = t2.keyfld
where t2.fldz = 'foo'
so for your example you would write
on table1.keyfld = table2.keyfld
set table1.fldx = table2.fldy
where table2.fldz = 'foo'
on Employees.EmpID = Salaries.EmpID
set Employees.SALARY = Salaries.SALARY
Still won't work!
I am being asked to supply a parameter value for employees.salary and then it tells me the table field is not updateable