I have a table of products, and I need to write an SQL query which orders these products alphabetically according to their manufacturer.
i.e.
SELECT * FROM ProductsTable ORDER BY Manufacturer
But the complication is that we are trying to promote one particular manufacturer. So all the products for this manufacturer need to come at the top and not be alphabetised with the rest.
e.g.
+---------+------------+
|Product |Manufacturer|
+---------+------------+
|pears |Jim |
|apples |Fred |
|tomatoes |Adam |
|oranges |Bob |
|bananas |Fred |
|grapes |Carl |
+---------+------------+
If we are promoting Fred, the query would result in
+---------+------------+
|Product |Manufacturer|
+---------+------------+
|apples |Fred |
|bananas |Fred |
|tomatoes |Adam |
|oranges |Bob |
|grapes |Carl |
|pears |Jim |
+---------+------------+
Is there a way to do this?
Try: