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

  • Home
  • SEARCH
  • 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 8647639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:07:04+00:00 2026-06-12T13:07:04+00:00

I have a query that is returning a list of 25 doctors that needs

  • 0

I have a query that is returning a list of 25 doctors that needs to reflect their uploaded files (cloud_uploads) in a column. The problem is, I do not want to limit the number of files that are listed, but the limit seems to be applying to the files as well. Other similar questions on SO that I’ve seen have the opposite problem – they want to limit the files without limiting the total rows returned. I have doctors with more than 25 uploaded files, but the list is only showing the first 25 files rather than all of them.

Because this is a programmatically generated query, I can’t separate it into multiple queries. It needs to be one. So, if the answer is that it can’t be done, I can accept that.

Here is the current query:

SELECT SQL_CALC_FOUND_ROWS records.instance_id,
        instances.patient_id,
        TRIM(form_1_data.field_2) AS field_0,
        TRIM(form_1_data.field_1) AS field_1,
        TRIM(form_1_data.field_87) AS field_2,
        GROUP_CONCAT(DISTINCT CONCAT (
                        extensible_8_data.field_953,
                        '|||',
                        cloud_uploads.NAME
                        ) SEPARATOR '<br />') AS field_3
FROM form_6_data AS records
LEFT JOIN instances
        ON instances.id = records.instance_id
LEFT JOIN extensible_8_data
        ON records.instance_id = extensible_8_data.instance_id
LEFT JOIN cloud_uploads
        ON extensible_8_data.field_953 = cloud_uploads.id
LEFT JOIN form_1_data
        ON records.field_89 = form_1_data.instance_id
WHERE instances.form_id = 6
        AND instances.active = 1
        AND (
                cloud_uploads.active = 1
                OR cloud_uploads.active IS NULL
                )
GROUP BY records.instance_id
ORDER BY records.instance_id DESC LIMIT 0, 25
  • 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-06-12T13:07:06+00:00Added an answer on June 12, 2026 at 1:07 pm

    Join a subquery that selects the 25 doctors of interest with their files:

    SELECT SQL_CALC_FOUND_ROWS records.instance_id,
            instances.patient_id,
            TRIM(form_1_data.field_2)  AS field_0,
            TRIM(form_1_data.field_1)  AS field_1,
            TRIM(form_1_data.field_87) AS field_2,
            GROUP_CONCAT(DISTINCT CONCAT (
                            extensible_8_data.field_953,
                            '|||',
                            cloud_uploads.NAME
                            ) SEPARATOR '<br />') AS field_3
    FROM (SELECT * FROM form_6_data ORDER BY instance_id DESC LIMIT 25) AS records
    LEFT JOIN instances
            ON instances.id = records.instance_id
    LEFT JOIN extensible_8_data
            ON records.instance_id = extensible_8_data.instance_id
    LEFT JOIN cloud_uploads
            ON extensible_8_data.field_953 = cloud_uploads.id
    LEFT JOIN form_1_data
            ON records.field_89 = form_1_data.instance_id
    WHERE instances.form_id = 6
            AND instances.active = 1
            AND (
                    cloud_uploads.active = 1
                    OR cloud_uploads.active IS NULL
                    )
    GROUP BY records.instance_id
    ORDER BY records.instance_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following LINQ expression that's not returning the appropriate response var query
I have a query that is returning in vastly different amounts of time between
I have a simple Nhibernate Linq query that is returning more results than expected:
So I have this awesome MySQL query that's returning me an awesome array >
This query that I have is returning therapists whose 'therapistTable.activated' is equal to false
Problem I have a Fetch XML query that has an aggregate count on a
I have a LIST (query output)that has the distinct ID’s from a table Account.
So I have a query that I am returning all of the items into
I have a function that is not returning a value the way I would
I simply have a table that contains a list of countries and their ISO

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.