Database Development

How to optimize selection of pairs from one column of the table (self-join)?

I have a table where one row is – user’s name, place he attended, time when he was there I need to select all pairs of places where any user was (if user was at place a and place b i need row like this: user, place a, place b, time at place a, time […]