clientname = 'Client A' THEN ColumnA, ColumnB END ) ORDER BY ( CASE WHEN cli. If there was, I probably (although certainly loathed it if I did) built a Dynamic SQL statement with a fully defined ORDER BY clause and then launched with an EXEC command if I simply wanted different sort orders based on differening sets of conditions, or if I wanted the results in a single rowset merely created two different queries with their own ORDER BY clauses and then joined with a UNION. and frankly, I've never encountered a use-case where I needed to apply conditional sorting. so it's been a few years since I spent most of my day writing SQL code.
0 Comments
Leave a Reply. |