I have this query in which I included a case
statement:
SELECT
tsp_filtered_data.increment_id,
tsp_filtered_data.ESN,
tsp_filtered_data.Model,
tsp_filtered_data.Fault,
CASE
WHEN tsp_filtered_data.ESN RLIKE '^[0-9A-F]{8}$'
THEN 'valid ESN'
ELSE 'Invalid ESN'
END AS ESN_status
FROM
tsc_document_status
INNER JOIN
tsp_filtered_data ON tsp_filtered_data.Document_id = tsc_document_status.warehouse_transfer_note_id
ORDER BY
tsp_filtered_data.ESN DESC
and it returns this output:
Can I use those results of 'valid ESN' and 'Invalid ESN' in to order by
my requirement is to place all the 'Invalid ESN' lists to the top of the queried results, while next the 'Valid ESN' list.
how can i do the modification to the query..
ORDER BY ESN_status, tsp_filtered_data.ESN DESC
– Manav Oct 21 '17 at 10:39