本文介绍了我应该为此查询添加数据表吗? {未解决}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
在我的数据库模式中,有以下内容:
tblQuery(问题)
tblAnswers
tblCustomers
tblAnswers
tblDesignations
tblOperators
在我的ERD上编码并没有任何桥接表来链接任何两个表.它们都是直接连接的.我需要检索所有查询的答案以及发送查询的客户.因此,我必须链接三个tbalCustomers,tblQueries和tblAnswers
这是我用于撤回一行的SP:
Hi friend,
In my DB schema i have the followng tbales:
tblQuery (Questions)
tblAnswers
tblCustomers
tblAnswers
tblDesignations
tblOperators
accoding my ERD there arent any bridging tables to link any two tables. all of them are directly connected. I need to retreive a Query with all it's answers and Customers who sent the query. therefore i have to link three tbales tblCustomers, tblQueries and tblAnswers
Here is my SP for retreiving a row:
ALTER PROCEDURE ProcGetCustomerWithQueries
@PCustIndex int
AS
BEGIN
SELECT
C.CustIndex, C.FirstName, C.LastName,
Q.QID, Q.QText, Q.QCat, A.AnsID, A.AnsText
FROM tblCustomers C, tblQueries Q, tblAnswers A
WHERE
C.CustIndex = Q.CustIndex
AND
Q.QID = A.QID
and
Q.CustIndex = @PCustIndex
END
GO
推荐答案
这篇关于我应该为此查询添加数据表吗? {未解决}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!