Okay, well I've tried the GROUP BY, it almost works.
I've added a DISTINCT command to prevent duplication of rows being outputted;
(tie this to the top of your code):
and following your idea, I added a GROUP BY command to the bottom of the code.Code:select distinct
(tie this to the bottom of your code):
This groups data how you want it. But my output is incorrect, and I think it must have something to do with the big SQL command you wrote.Code:GROUP BY t1.user_id_2";
As you can see, it groups the data, but it's outputting somebody who shouldn't be there.. Alice.
There's a problem using GROUP BY anyway.quickMale is matched with sarah
quickMale is matched with Olga
quickMale is matched with Charlie
quickMale is matched with Oisan
quickMale is matched with helen
quickMale is matched with Jenni
quickMale is matched with Alice
quickMale is matched with Noella
quickMale is matched with Emma
quickMale is matched with Lillie
Alice is matched with quickMale
quickMale is matched with quickFemale
Because I've used GROUP BY on user_id_2, it'll filter out everybody else.
This means I cannot email anybody else in this loop other than, in this example, quickMale.
Surely there must be a way of acheiving this.
I've been thinking about creating a temporary table which all the output from your super sql command is placed.
Then we can use another query to find all distinct occurances of user_id_1 and output his/her matches.
Would that work? How do you suggest solving this?








Bookmarks