I don't think you can order on a certain condition within a query. You can do this with a stored procedure though ... Or, but that would require some logic in the app, with views
Greets Olaf On 11/5/07 10:55 AM, "Christoph Boget" <[EMAIL PROTECTED]> wrote: > 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]