Solved

SQL to retrieve data

Posted on 2000-03-16
4
183 Views
Last Modified: 2010-05-02
Hello
I have two tables related by common field.
1ª table-Clients
2º table-invoices
common field->clientID
In SQL, how can I retrieve clients from the first table that have not invoices in the second table.
I'm working with VB 6.0

Thanks
0
Comment
Question by:asimoes
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
JHausmann earned 50 total points
ID: 2625037
select * from clients where clientid not in(select distinct clientid from invoices)
0
 

Expert Comment

by:PatriceF
ID: 2626858
Select * from Clients left join Invoices on
Clients.ClientID = Invoice.ClientID
where Invoices.ClientID is null
0
 
LVL 2

Expert Comment

by:JHausmann
ID: 2628940
I realize you're new Patrice so I hope that I don't sound too harsh. When someone posts a comment in this group (and not all of the groups work the same way, you're just going to have to learn which ones do/don't over time), you should also post a comment. You then leave it up to the person who posed the  question to decide which answer best suits his/her needs.

As it stands now, because you "answered" the question, you will default to getting the points if the person that answered the question does not accept your answer after a certain period of time.

Welcome to Expert Exchange, BTW.
0
 

Expert Comment

by:PatriceF
ID: 2635007
Sorry, this is my answer as a comment...
Select * from Clients left join Invoices on
Clients.ClientID = Invoice.ClientID
where Invoices.ClientID is null
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now