Let's say that I have the following dataset after an INNER JOIN query: UserName | InventoryItem | InventoryAmount -------- | ------------- | --------------- Joe | Hammer | 2 Joe | Nails | 7 Joe | Screws | 9 Bob | Hammer | 1 Bob | Hand Saw | 2 Bob | Power Saw | 1 Briggs | Hammer | 4 Briggs | Screwdriver | 1 Briggs | Wrench | 3
Is it possible to order by InventoryAmount but only when InventoryItem has a particular value? Say, "Hammer"? So that after the sort, the dataset looks like this: UserName | InventoryItem | InventoryAmount -------- | ------------- | --------------- Bob | Hammer | 1 Bob | Hand Saw | 2 Bob | Power Saw | 1 Joe | Hammer | 2 Joe | Nails | 7 Joe | Screws | 9 Briggs | Hammer | 4 Briggs | Screwdriver | 1 Briggs | Wrench | 3 I know I can do this programatically after the fact while I'm processing the dataset but I'm hoping this can be achieved at the database level. Any information and/or advice would be appreciated! thnx, Christoph