DOWNLOAD THE CODE:
Download the Code 26963.zip

From the Customers table in the Northwind sample database, I want to return the list of customers by country in the custom sort order that Figure 1 shows. How can I define that sort order?

To define the custom sort order, you can use a CASE expression in the ORDER BY clause, as Listing 1 shows. Alternatively, you can create an auxiliary table in which you store your custom sort order, then join the auxiliary table to the Customers table, as Listing 2 shows.

End of Article




You must log on before posting a comment.

If you don't have a username & password, please register now.

 
 

ADS BY GOOGLE