Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7588435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:55:09+00:00 2026-05-30T19:55:09+00:00

I have some table restore user articles. the table struction like… id | uid

  • 0

I have some table restore user articles. the table struction like…

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  |       |
...

Then I want get 10 result witch 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)

And how to make a further query. 10 result with 10 different uid (a.uid!=b.uid)? And the code is too long… Any easy way? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:55:10+00:00Added an answer on May 30, 2026 at 7:55 pm

    Change the limit and include a group by :

    select * from my_table where image!='' order by rand() group by uid limit 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code to update a database table that looks like try {
I have some table <table> <tr class=trclass> <td class =tdc> <img src=/images/products/nophoto_s.jpg> </td> </tr>
In my application I have some table data that looks like this: <table> <tr>
In a nutshell: I have some database table data that I want to populate
I have some table: table ASK with idask table PREFERENCES with idpref , fk_idask
I have some table structure: <tr class=row-2><tr> <tr class=row-3>..<tr> <tr class=row-4>..<tr> <tr class=row-5>..<tr> <tr
I have some char() fields in a DBF table that were left encrypted by
I have some data grouped in a table by a certain criteria, and for
i have some fields in my database table,and a field with phone name ,
i have some rows of data displayed in a table and on mouse over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.