我正在使用以下查询返回记录列表:
Select DISTINCT A.Id Questionid,
A.Created_Date Questiondate,
Row_Number() Over ( Order By A.Created_Date Desc) Row_Id,
B.Id Answerid,
COUNT(*) OVER (partition by a.id) QCOUNT,
B.Created_Date Answerdate
From Question_Table A
Inner Join Answers_Table B
ON A.Id = B.Question_Id
AND A.Is_Active = 1
AND A.Is_Delete = 0
And B.Is_Active = 1
And B.Is_Delete = 0
And A.Category_Id = 1318221772
Answers_Table.question_id 映射到 question_table.id
因此,对于特定的问题 ID,answers_table 上可以有不止一行。
现在显示的输出是:
QUESTIONID QUESTIONDATE ROW_ID ANSWERID QCOUNT ANSWERDATE
52776 08-DEC-12 1 31383 2 09-DEC-12
52776 08-DEC-12 2 31482 2 10-DEC-12
52719 07-DEC-12 3 31321 1 07-DEC-12
但我要求将输出显示为:
QUESTIONID QUESTIONDATE ROW_ID ANSWERID QCOUNT ANSWERDATE
52776 08-DEC-12 1 31383 2 09-DEC-12
52719 07-DEC-12 3 31321 1 07-DEC-12
如何在输出中显示唯一的 questionid(如 52776,52719)?