如果未在表中找到记录,请添加默认值 [英] Add default value if record not found from table
问题描述
我有三张桌子
会员
-id
-name
-address
tax_bill
-bill_id
-member_id
-tax_amount
tax_receipt
-receipt_id
-member_id
-bill_id
从上表我想用会员详细信息和收据详细信息显示会员详细信息。最初tax_receipt将为空,当用户支付税款时,该条目将在tax_receipt详细信息中。我想创建一个报告,其中将显示来自成员表的所有成员详细信息,来自tax_bill的税务明细和来自tax_receipt的收据明细。我要的是显示为零如果记录未在tax_receipt表发现perticular成员的tax_bill细节。
此外,我使用的连接查询所以这将是有用的如果建议将使用加入查询。
提前谢谢你:
什么我试过了:
我尝试过子查询和其他但是徒劳无功
SQL Server的左联接带3个表 - 堆栈溢出 [ ^ ]
I have three tables
member
-id
-name
-address
tax_bill
-bill_id
-member_id
-tax_amount
tax_receipt
-receipt_id
-member_id
-bill_id
From above tables i want to show the member details with his bill detail and receipt details. Initially the tax_receipt will be empty, When the user will pay the tax, the entry will be in the tax_receipt detail. I want to create a report in which all the members detail from member table, tax detail from tax_bill and receipt detail from tax_receipt will be displayed. What i want is to show ZERO if the record is not found in tax_receipt table for perticular member's tax_bill details.
Also, i am using join query so it will be usefull if suggestion will be using join query.
Thank you in advance :)
What I have tried:
I have tried with sub query and other but going in vain
SQL Server Left Join with 3 tables - Stack Overflow[^]
这篇关于如果未在表中找到记录,请添加默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!