私はいくつかのテーブルのユーザーの記事を復元しています。テーブルstructionのような...php myaql union query with different uid
id | uid | imgae |
1 | 1 | 1.jpg |
2 | 1 | |
3 | 2 | 2.jpg |
4 | 3 | 3.jpg |
5 | 3 | |
6 | 3 | 4.jpg |
7 | 4 | |
...
は、それから私は、10結果の魔女image!=''
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
UNION
(select * from my_table where image!='' order by rand() limit 1)
そして、どのようにさらにクエリを作ることを取得します。 10件の結果が10件ありuid
(a.uid!=b.uid
)?コードが長すぎる...簡単な方法?ありがとう。