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)
 Result of two views

Author  Topic 

tingu
Starting Member

4 Posts

Posted - 2007-04-11 : 06:18:32
I have two views VMA and SOVMA.

I run two queries as below and get the result.

q1) Select vm.LNo, vm.VLk From VMA vm WHERE vm.SaId = 2 AND vm.TOVID = 2

q2) Select vs.LNo, vs.VLK FROM SOVMA vs Where vm.SaID = 2 AND vm.TOVID = 2 AND vs.SOVendor = 1

Now i want that result of q1 should not have result of q2

Please help.
Thanx


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-11 : 06:21:30
Select vm.LNo, vm.VLk From VMA as vm
left join SOVMA as vs on vs.lno = vm.lso and vs.vlk = vm.vlk and vm.SaID = 2 AND vm.TOVID = 2 AND vs.SOVendor = 1
WHERE vm.SaId = 2 AND vm.TOVID = 2
and vs.lso is null


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

tingu
Starting Member

4 Posts

Posted - 2007-04-11 : 06:33:34
Thanks Peso....
I worked.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-11 : 06:44:55
Me too...

Good luck!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-11 : 09:17:43
Also Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

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

- Advertisement -