How to combine the result of two SELECT statements

I am new to SQL Server. Please help me with my problem below.

I have a table as shown below

Job  Quantity Status
1      100      OK
2      400      HOLD
3      200      HOLD
4      450      OK

I would like to write a request now in such a way that first all jobs with an amount equal to or more than 400 with the status "OK" appear, and then "Work with Quanitty" equal to or more than 400 with the status of "HOLD". Then all tasks with an amount of less than 400 with the status OK will appear and after that tasks with an amount of less than 400 with the status of HOLD should appear.

This is what my result should look like. (Sorry for the above perplexing item)

Job  Quantity Status
4      450      OK
2      400      HOLD
1      100      OK
3      200      HOLD

How should I do it? Someone please help me.

+3
source share
2 answers
SELECT Job, Quantity, Status 
  FROM myTable
 ORDER BY CASE WHEN Quantity >= 400 AND Status = 'OK' THEN 1 
               WHEN Quantity >= 400 AND Status = 'Hold' THEN 2
               WHEN Status = 'OK' THEN 3
               ELSE 4
          END
+6
source

:

ORDER BY Quantity / 400 DESC,
  CASE [Status] WHEN 'OK' THEN 1 ELSE 2 END;

>= 800 . , :

ORDER BY CASE Quantity / 400 WHEN 0 THEN 2 ELSE 1 END,
  CASE [Status] WHEN 'OK' THEN 1 ELSE 2 END;

, [Status] OK HOLD, :

ORDER BY CASE Quantity / 400 WHEN 0 THEN 2 ELSE 1 END,
  [Status] DESC;
+1