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
 SQL Server Development (2000)
 how to write this condition

Author  Topic 

mdanwerali
Starting Member

30 Posts

Posted - 2002-11-22 : 06:22:37
Hi,

Please can u suggest me how to write this query?

Select * from empmaster
where (empno,deptno) in (select empno,deptno from deptmaster)

this is a successfully query in Oracle, but how to write the same query in Sql?

md anwer ali

nr
SQLTeam MVY

12543 Posts

Posted - 2002-11-22 : 06:29:21
You can concatenate as strings into a single field (bad idea on anything but smallk tables) or

Select * from empmaster
where exists (select * from deptmaster where empmaster.empno = deptmaster.empno and empmaster.deptno = deptmaster.deptno)

or
select distinct empmaster.*
from empmaster, deptmaster
where empmaster.empno = deptmaster.empno
and empmaster.deptno = deptmaster.deptno


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.

Edited by - nr on 11/22/2002 06:30:40
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-11-22 : 07:02:43
Please don't cross-post:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=21832

Go to Top of Page
   

- Advertisement -