I am working on an SQL query where I am looking for all possible combinations. My table looks like this:
Table: Fruits
|ID | Name |
|1 | Apple |
|2 | Banana|
|3 | Cherry|
|4 | Peach |
I am trying to get the out put of all possible combinations of two of the fruits with no repeats (ie, if there is Apple, Banana then I do not want Banana, Apple):
Apple, Apple
Apple, Banana
Apple, Cherry
...
Cherry, Peach
Peach, Peach
All I have so far is a way to make two rows of Fruits
SELECT Name AS Fruit1, Name AS Fruit2
FROM Fruits
Any help would be very appreciated!