你好我有一个问题我想通过按天排序来显示日期到现在生日第一次出现,例如:我有
15/08/2013 00:00:00
15/08/2013 00:00:00
29/08/2012 00:00:00
23/08/2012 00:00:00
16/08/2012 00:00:00
10/08/2012 00:00:00
我希望它是
10/08/2012 00:00:00
15/08/2013 00:00:00
15/08/2013 00:00:00
16/08/2012 00:00:00
23/08/2012 00:00:00
29/08/2012 00:00:00
我写:
public DataTable BirtdayReport(DateTime d)
{
try
{
string query = "SELECT C.Class_Name as [כיתה], P.Person_First_Name as [שם פרטי], P.Person_Last_Name as [שם משפחה], P.Date_Of_Birth AS [תאריך לידה] ";
query += "FROM Person as P INNER JOIN Customer as C ON P.[Person _ID] = C.Person_ID WHERE MONTH(P.Date_Of_Birth)=Month(@d) ORDER BY (DAYOFMONTH(Person.Date_Of_Birth)) ;";
OleDbCommand command = new OleDbCommand();
command.CommandText = query;
command.Parameters.AddWithValue("@d", d);
DataTable dt = AdoHelper.ExecuteDataTable(command);
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
但它不像我想要的那样排序。你能帮助我吗?