mysql select id title album_id from gallery_img WHERE user_id ---- ---

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mysql> select id,title,album_id from gallery_img WHERE user_id=1;
+----+------------+----------+
| id | title | album_id |
+----+------------+----------+
| 1 | drink | 1 |
| 2 | seda | 2 |
| 3 | seda1 | 2 |
| 4 | seda1333 | 2 |
| 5 | sdfsdf | 2 |
| 6 | sdfsdfw | 2 |
| 7 | asdfsdfw | 2 |
| 8 | asdfsdfwq | 2 |
| 9 | 123 | 2 |
| 10 | fsdfsdf | 2 |
| 11 | fsdfsdf123 | 2 |
| 12 | fsdfsdf123 | 2 |
| 13 | logo | 1 |
+----+------------+----------+
13 rows in set (0.00 sec)
mysql> select id,title,album_id from gallery_img WHERE user_id=1 GROUP BY album_id;
+----+-------+----------+
| id | title | album_id |
+----+-------+----------+
| 1 | drink | 1 |
| 2 | seda | 2 |
+----+-------+----------+
2 rows in set (0.00 sec)