Camillia
asked on
Order by but want it in specific order
This is SQL 2014
I have this SQL statement but users want the rows to be displayed in specific order
This is the output
I need to order the output in a specific order of "RemarkSectionId"
8
3
7
9
1
2
How can I do that? with a case statement?
I have this SQL statement but users want the rows to be displayed in specific order
SELECT orm.OrderRemarkId, rs.RemarksSectionId, orm.Remark, CASE rs.Name WHEN 'Order Terms' THEN 'Terms : ' WHEN 'Price' THEN 'Price : ' ELSE '' END AS Name
FROM RemarksSections AS rs LEFT OUTER JOIN
OrderRemarks AS orm ON orm.Section_RemarksSectionId = rs.RemarksSectionId LEFT OUTER JOIN
CommSalesOrders AS c ON c.CommSalesOrderId = orm.CommSalesOrder_CommSalesOrderId
WHERE (c.ConfirmationNumber = 'wie200-001') AND (rs.Name NOT IN ('Header', 'Any Section', 'Order Detail','Order Message'))
This is the output
I need to order the output in a specific order of "RemarkSectionId"
8
3
7
9
1
2
How can I do that? with a case statement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER