2010-10-14 54 views
1

我正在使用sql server 2005.在這個查詢中,我希望登錄用戶的詳細信息也應該顯示,但它不顯示。 因此,請修改查詢,以便登錄用戶的詳細信息也應顯示與會議[userId] .tostring()的幫助;在asp.net中修改sql查詢?

查詢我寫的是:

SELECT DISTINCT MUDMEMBER.PK_ID,MUDMEMBER.EMPLOYEE_ID,LKB.BANK_NAME,MUHD:

SELECT DISTINCT MUDMEMBER.PK_ID, MUDMEMBER.EMPLOYEE_ID, LKB.BANK_NAME, MUHD.SALARY_ACCOUNT_NO, MUHD.PF_NO, 
MUHD.PAN_NO, MUHD.GENDER, LKD.DESIGNATION_NAME FROM M_LEADERLED MLL INNER JOIN M_USER_DETAILS MUDMEMBER ON 
MLL.LED_ID = MUDMEMBER.PK_ID AND MLL.START_DATE <= Getdate() AND MLL.END_DATE > Getdate() AND MLL.LEADER_ID = '1' LEFT OUTER JOIN 
    M_USER_HR_DETAILS MUHD ON MUHD.FK_USER_ID = MUDMEMBER.PK_ID AND MUHD.IS_ACTIVE =1 LEFT OUTER JOIN 
    LK_BANKS LKB ON LKB.PK_ID = MUHD.FK_BANK_ID LEFT OUTER JOIN LK_DESIGNATION LKD ON 
    LKD.DESIGNATION_VALUE = MUHD.FK_DESIGNATION_VALUE AND LKD.FK_ORGANIZATION_ID = 1 AND LKD.IS_ACTIVE = 1 WHERE MUDMEMBER.ACTIVE = 1 
+0

你能提供更多細節嗎?比如你想要顯示哪些列,以及你想在哪裏使用會話[userid]? – 2010-10-14 12:18:56

+0

@Shalni:你在哪裏寫這個查詢,在ASP.net頁面或StoreProcedure – Vijjendra 2010-10-14 12:22:27

+0

我想要顯示的列如上所示。我只想添加一行登錄用戶與上面相同的列。喜歡:PK_ID =會話[userid] .Tostring() – Shalni 2010-10-14 12:22:48

回答

2

ASP.Net頁面,你可以如下獲取的loggedIn用戶的細節.SALARY_ACCOUNT_NO,MUHD.PF_NO, MUHD.PAN_NO,MUHD.GENDER,LKD.DESIGNATION_NAME FROM M_LEADERLED MLL INNER JOIN M_USER_DETAILS MUDMEMBER ON MLL.LED_ID = MUDMEMBER.PK_ID AND MLL.START_DATE < = GETDATE()和MLL.END_DATE> GETDATE ()
AND MLL.LEADER_ID = '1' LEFT OUTER JOIN MUHD.FK_USER_ID = MUDMEMBER.PK_ID AND MUHD.IS_ACTIVE = 1 LEFT OUTER JOIN LKB.PK_ID = MUHD.FK_BANK_ID LEFT OUTER JOIN LK_DESIGNATION LKD ON M_USER_HR_DETAILS MUHD ON LK_BANKS LKB ON LKD.DESIGNATION_VALUE = MUHD.FK_DESIGNATION_VALUE AND LKD.FK_ORGANIZATION_ID = 1 AND LKD.IS_ACTIVE = 1 WHERE MUDMEMBER.ACTIVE = 1 AND MUDMEMBER.PK_ID = 「+ Convert.ToInt32(會話[」 用戶ID 「])+」

+0

對不起,先生只顯示一行登錄用戶ID,其餘行不會顯示。 – Shalni 2010-10-14 12:28:20

+0

@Shalini:你能詳細解釋一下你到底想要什麼嗎? – Vijjendra 2010-10-14 12:38:30