We are currently querying the Oracle DB and returning the result in the JSON format.The Query results are returning the more duplicate rows. The Controller is something like below
public HttpResponseMessage Getdetails([FromUri] string[] Column)
{
List<string> selectionStrings = new List<string>();
string connStr = ConfigurationManager.ConnectionStrings["PConnection"].ConnectionString;
using (OracleConnection dbconn = new OracleConnection(connStr))
{
DataSet userDataset = new DataSet();
var colDict = new Dictionary<string, string>()
{
{"CATEGORY", "STCD_PRIO_CATEGORY_DESCR.DESCR"},
{"SESSION_NUMBER", "STCD_PRIO_CATEGORY_DESCR.SESSION_NUM"},
{"SESSION_START_DATE","Trunc(STCD_PRIO_CATEGORY_DESCR.START_DATE)"},
{"SESSION_START_TIME","STCD_PRIO_CATEGORY_DESCR.START_DATE"}}};
foreach (string col in Column)
{
string selector = colDict[col];
selectionStrings.Add(string.Format("{0} AS {1}", selector, col));
}
string selectString = string.Join(",", selectionStrings);
var strQuery = string.Format(@"SELECT {0}
FROM
STCD_PRIO_CATEGORY_DESCR", selectString);
}}}
So if I just add Distinct in the Select statement as
var strQuery = string.Format(@"SELECT DISTINCT {0}
FROM
STCD_PRIO_CATEGORY_DESCR", selectString);
is that should be enough? Or should we be putting DISTINCT before all the Column names