Solved

SQL to retrieve data

Posted on 2000-03-16
4
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 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