I would like to order a query based on whether or not a column has a certain value... In other words, if I have a table, Employees, with columns LastName, FirstName and StartDate, I'd like to output all columns with LastName = 'Smith', then all the rest of the columns in alphabetical order...<br>
<br>
Is this possible????<br>
<br>
I'd like one output set that would equal this..<br>
<br>
Select LastName,FirstName,StartDate from Employees where LastName='Smith' order by StartDate desc<br>
<br>
Select LastName,FirstName,StartDate from Employees where LastName != 'Smith' order by StartDate desc<br>
<br>
I've tried the union operator, but you can't use the ORDER BY clause more than once, and just putting it at the end mixes up the results.<br>
<br>
I'm sure I'm missing something quite simple, but I'm really stumped on this one... Any takers?????
<br>
Is this possible????<br>
<br>
I'd like one output set that would equal this..<br>
<br>
Select LastName,FirstName,StartDate from Employees where LastName='Smith' order by StartDate desc<br>
<br>
Select LastName,FirstName,StartDate from Employees where LastName != 'Smith' order by StartDate desc<br>
<br>
I've tried the union operator, but you can't use the ORDER BY clause more than once, and just putting it at the end mixes up the results.<br>
<br>
I'm sure I'm missing something quite simple, but I'm really stumped on this one... Any takers?????