Ask a question about php+mysql.
To query data in a table, the condition is UID in (all-in-one). So satisfying uid=1 or 2 or 3 of the query.
How do I get one condition for each meeting?
For example, the UID is a few of the three, through the SQL query, only the first UID is 1, the UID is the first of 2, the UID is the first of 3.
------Solution--------------------
First of all your data must have an ID, a UID
The query uid is a few: (assuming that the table is named ' User ', there are only two fields in the table, ID and UID, respectively)
Select Id,count (UID) from the user group by UID has uid=1 or uid=2 or uid = 3;
The first of the query UID is 1:
SELECT * from user where uid=1 limit 1;
------Solution--------------------
You can take one of the resulting sets of queries in groups
------Solution--------------------
Where (select COUNT (*) from tbl_name where Uid=a.uid and ID
------Solution--------------------
Only one rule is taken for each condition:
SELECT * from the TT where UID in (n/a) group by UID;
------Solution--------------------
Select a.* from table A where 1> (select COUNT (1) from table B where a.id = b.ID and a.id > b.ID) A nd a.uid in (All-in-all)
------Solution--------------------
Select top 1 * from table GROUP BY
------Solution--------------------
Group by can achieve