My output is not as I expected, what i want is eliminated duplicated data. i tried to use group by and distinct before but it doesn’t work.=(
data in my database
who are u? A
who are u? B
who are u? C
who am i? A
who am i? B
who am i? C
current output
Column ‘ExerciseTable.r1’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
expected output
who are u? A
B
C
Who am i? A
B
C
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Question],[r1] FROM [ExerciseTable] GROUP BY [Question]">
</asp:SqlDataSource>
In your SQL Statement(c1 first column, c2 second column) :
Without a fixed RowNumber (t.[RN]) :
Or you can iterate thru the result set (Eg:a List) using C#/VB.Net and remove the data on the column for the following rows after the first one having ‘who am i?’ and the same for ‘who are u?’