I am quering a sharepoint list using CAML query. Here i am using Order by condition on one list column. There is a chance of having null values in order column, at this scenario I want to Order the list using another list column (ex: Title column'). How to add this Order by condition in caml query to fetch the sharepoint list items.
My Code is:
query.ViewXml = "<View><Query>";
query.ViewXml += "<OrderBy><FieldRef Name='" + orderBy + "'/></OrderBy>";
query.ViewXml += "<Where><Eq><FieldRef Name='" + fieldRef + "'/><Value Type = '" + type + "'>" + value + "</Value></Eq></Where>";
query.ViewXml += "</Query></View>";
Best Answer
You can have multiple fields in the OrderBy-section:
This will be equivalent to: Order by 'orderBy' Then By 'orderBySecondary'