• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Day 5. Finding the Data You Need: An Int... > Sorting and Evaluating Query Results

Sorting and Evaluating Query Results

If I've built a successful query that returns just the records I want, sometimes I'm content to just let them display in any old order, as in the examples listed so far. But I may also want to build an application that will sort data alphabetically or numerically based on the contents of a certain field. SQL provides a tool for this in ORDER BY.

Ordering Output with ORDER BY

By default, ColdFusion queries return records in the order they find them. In all the query examples from my database of songs, the output results have appeared in the order they're shown in the table in Table 5.1. For my small Elvis database, this hasn't been a problem, but let's look at another example in which I might want to change the output order.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint