To select rows with one unique field from mysql table?

0 like 0 dislike
5 views
Similar topics watched, but no solution came up :(
There is a mysql table of the form:
From | TO | TEXT | Data | ----------------------------------- name1 | name3 | text1 | Data1 name1 | name3 | text2 | Data2 name2 | name3 | text3 | Data3 name3 | name1 | text4 | Data4


You must select rows to get the following:
From | TO | TEXT | Data | ----------------------------------- name1 | name3 | text1 | Data1 name2 | name3 | text3 | Data3


Simple queries with DISTINCT or GROUP BY does not help, there is an option:
WHERE to='name3'

If you offer a solution (php+ PDO) will do fine
by | 5 views

1 Answer

0 like 0 dislike
The question is not entirely understood, but to get the second from the first you can request a
SELECT * FROM `your_table` WHERE `to`='name3' GROUP BY `from`;

If that's not what you need, then update the question by adding details.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
asked May 21, 2019 by vegarulez
110,608 questions
257,186 answers
0 comments
33,770 users