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
 Site Related Forums
 Article Discussion
 Article: Using Subqueries to Select Records
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 08/15/2000 :  20:49:19  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
John writes "Okay, here's my problem. I have these two tables: INVOICE, which includes everything about a particular invoice including a vendor_id. The second table is VENDOR, which includes the vendor name for each vendor_id. What I want to be able to do is select from the VENDOR table a list of all of the vendor_names that have appeared in the INVOICE table (even if they have appeared in the INVOICE table many times, I just want them to show up once). Is this possible?"

Article Link.

Anonymous
Starting Member

0 Posts

Posted - 08/24/2000 :  23:18:11  Show Profile  Reply with Quote
Using Subqueries to select Records

Try using INNER JOIN with SELECT DISTINCT statement. It should select only single matched records.
SELECT DISTINCT VENDOR.VENDORNAME FROM VENDOR
INNER JOIN INVOICE ON VENDOR.VENDORNAME = INVOICE.VENDORNAME

Go to Top of Page

cducker
Starting Member

1 Posts

Posted - 04/09/2002 :  17:15:51  Show Profile  Reply with Quote
Has anyone ever noticed a performance decline when the results of the nested query in the IN statement returns 100s of results?

Go to Top of Page

Arnold Fribble
Yak-finder General

United Kingdom
1961 Posts

Posted - 04/09/2002 :  18:29:36  Show Profile  Reply with Quote
Do you have a specific example?


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.31 seconds. Powered By: Snitz Forums 2000