Q:

mysql group by on unique combination of 2 columns

I have a table: Employee
columns:
1.  id
2.  name
3.  city1
4.  city2

I want to GROUP BY the combination of city1 and city2 so that e.g. 

an employee with city1: 'Bangalore' and city2: 'Chennai' 
and another employee with city1: 'Chennai' and city2: 'Bangalore' 

comes in a single group when done GROUP BY. 
Help me construct this sql. 

A:

The easiest way is to use least() and greatest():
select least(city1, city2) as city1, greatest(city1, city2) as city2, count(*)
from employees
group by least(city1, city2), greatest(city1, city2);

The logic is slightly more complex if you have NULL values.   The question says nothing about NULL values. 
Note:
This answer was edited to use:
group by city1, city2

Although technically correct, I removed the edit for two reasons:

city1 and city2 are ambiguous, because they are both the names of columns in the data and column aliases. 
Not all databases support column aliases in the group by clause. 

The first is the primary reason.   If the column aliases were different from names in the tables, then the alternative formulation would be fine.   Otherwise, I consider the code to be confusing and hence less maintainable and more prone to error.