SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Result of two views
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tingu
Starting Member

4 Posts

Posted - 04/11/2007 :  06:18:32  Show Profile  Reply with Quote
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

Sweden
30281 Posts

Posted - 04/11/2007 :  06:21:30  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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 - 04/11/2007 :  06:33:34  Show Profile  Reply with Quote
Thanks Peso....
I worked.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30281 Posts

Posted - 04/11/2007 :  06:44:55  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Me too...

Good luck!


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22769 Posts

Posted - 04/11/2007 :  09:17:43  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000