Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 UPDATE issue

Author  Topic 

allan_houston
Starting Member

18 Posts

Posted - 2006-07-11 : 16:14:27
Hello everybody


Since I've just begun working with SS 2000(yes, 2000) I got a question about UPDATE statement.

I come from Linux/MySQL world and this is possible in MySQL:

update emp inner join dept on emp.deptno=dept.deptno
set emp.comm=320
where dept.loc='CHICAGO' and emp.sal=1600


My QA was complaining about this piece of SQL.
How can I solve this one?


Kind regards
A.H.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-07-11 : 16:17:14
update e
set comm = 320
from emp e
inner join dept d
on e.deptno = d.deptno
where d.loc = 'CHICAGO' and e.sal = 1600

Tara Kizer
aka tduggan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-12 : 02:21:25
quote:
Originally posted by allan_houston

Hello everybody


Since I've just begun working with SS 2000(yes, 2000) I got a question about UPDATE statement.

I come from Linux/MySQL world and this is possible in MySQL:

update emp inner join dept on emp.deptno=dept.deptno
set emp.comm=320
where dept.loc='CHICAGO' and emp.sal=1600


My QA was complaining about this piece of SQL.
How can I solve this one?


Kind regards
A.H.


This type of syntax is available in ACCESS. But in sql server use the method Tara suggested

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

allan_houston
Starting Member

18 Posts

Posted - 2006-07-12 : 03:21:31
Thx Tara and thx madhivanan for the follow up.

It works.
Go to Top of Page
   

- Advertisement -