搜索与其他表连接的表的记录 [英] search a record of table which is join with other table

查看:67
本文介绍了搜索与其他表连接的表的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个表客户和服务,客户是父表,服务是子(详细)表.. customer_id是外键我想搜索多少记录不在服务表中在父表中

请尽快告诉我!!!!

如何?

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?

推荐答案

不知道你正在使用什么数据库我不能给你确切的语法,但这是一个基本的SQL语句,它会提取一个没有客户的服务列表:



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:

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.


这篇关于搜索与其他表连接的表的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆