M
M
Mosapi2018-05-02 16:14:07
MySQL
Mosapi, 2018-05-02 16:14:07

Select rows with one unique field from mysql table?

I looked at similar topics, but the solutions did not fit :(
There is a mysql table like:

From   |    TO    | TEXT | Data |
-----------------------------------
name1 | name3 | text1 | Data1
name1 | name3 | text2 | Data2
name2 | name3 | text3 | Data3
name3 | name1 | text4 | Data4

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

Simple queries with the addition: DISTINCT or GROUP BY do not help, there is a parameter:
WHERE to='name3'
If you offer a solution in (php + PDO) it will be generally great

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question