Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi
I have two table customer and service, customer is parent table and service is child(detail) table.. customer_id is foreign key i want to search how many record are not in service table which are in parent table
Please tell me soon!!!!
how?
Posted

1 solution

Without knowing what database your are using I can't give you exact syntax, but this is a basic SQL statement that would pull a list of services that do not have a customer:

SQL
SELECT * FROM tblService LEFT OUTER JOIN tblCustomer ON tblService.CustomerID = tblCustomer.CustomerID WHERE tblService.CustomerID IS NULL


If you want more help, you'll have to provide more information about your project and which part you are stuck. Click the Improve question link to add that. It's also helpful if you post the relevant code you are having trouble with.
 
Share this answer
 
Comments
Asitsingh 24-Apr-13 3:47am    
thanks sir but this will give me a blank table
sir i want see thote customer who is not in service table
Kschuler 24-Apr-13 9:21am    
Then use the above but switch the tables. Where I've used tblService use tblCustomer and vice versa.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900