Home > database >  The query results according to the specific value before ordering
The query results according to the specific value before ordering

Time:09-24

Check out the field is:
Company code division name
1 the management
1 A sorting

4 B branch3 C sorting
2 the management

2 D branch3 the management
4 E sorting

1 F branch4 the management

4 G branch
Excuse me if I can in the coding sequence according to the company at the same time, the same coding always let management department in front? thank you

CodePudding user response:

The order by decode (department name, 'management', 0, 1)

CodePudding user response:

ORDER BY "company code" CASE "department name" WHEN 'management departments' THEN "department name" END, "department name"

CodePudding user response:

The order by the company code and decode (department name, 'management', 0, 1) take no thanks
  • Related