• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

SQL ORDER By - two fields

lo5750ul

Senior member
I have a table with two columns of data (Data Type varchar and bit). I want to row sort the data by column two descending and then by column one ascending.

My SQL query thus far is:

SELECT *
FROM MyTable
ORDER BY column_two DESC, column_one


but the data is not sorted in column one.

I really need some help with this one.

Cheers.
 
Bit confused as to what you want to do but I think you want to use a group by statement.

Try select * from table order by column_2 desc group by column_1

It doesn't work swap the order and group by statements around i.e.

select * from table group by column_1 order by column_2 desc


LMK if it works.
 
Mitzi,

Thank you for your help. GROUP BY would not work because the column_one Data Type is BIT. I cheated and changed it to Tinyint and my SQL then worked.
 
Back
Top