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
 Transact-SQL (2000)
 queries help
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Hpolanco
Starting Member

7 Posts

Posted - 11/03/2006 :  18:41:30  Show Profile  Reply with Quote
Hello can anyone help me to correct this quary i am little confused

use HP
SELECT a.CustomerID, a.OrderID
FROM Orders a
WHERE a.CustomerID in
( SELECT b.CustomerID
FROM [Overdue Accounts] b
WHERE b.PaidInFull = 1
)

is is correct let me know if not tell me why and where was the problem.
Very thanks
HP

madhivanan
Premature Yak Congratulator

India
22744 Posts

Posted - 11/03/2006 :  19:06:53  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
It is correct
Did you get any error?

Madhivanan

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

samuelclay
Yak Posting Veteran

USA
71 Posts

Posted - 11/03/2006 :  19:10:48  Show Profile  Visit samuelclay's Homepage  Reply with Quote
Does it return the correct results? if so, then it is correct.
What are the desired results?
The syntax looks ok. You could also do it using a join.

SELECT a.CustomerID, a.OrderID
FROM Orders a
	INNER JOIN [Overdue Accounts] b
		ON a.CustomerID = b.CustomerID
		AND b.PaidInFull = 1
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.06 seconds. Powered By: Snitz Forums 2000