mardi 12 juillet 2016

SQL order by 2 columns

i have a table with 2 columns that contain either text or just 1

I want to execute a simple SELECT * FROM query on the table and order by the 2 columns

Some rows will have one column blank and others will not have any columns blank but i want to display the rows with either one or both columns that contain text at the bottom of my results

Sample Data:

sequence = 1
col1 = 'hello'
col2 = 'hello'

sequence = 2
col1 = ''
col2 = ''

sequence = 3
col1 = 'hello'
col2 = ''

so the above data should display in the order (by sequence):

2
3
1

Aucun commentaire:

Enregistrer un commentaire