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 3606116
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:12:31+00:00 2026-05-18T21:12:31+00:00

I am trying to figure out a complex (at least for me!) mysql query

  • 0

I am trying to figure out a complex (at least for me!) mysql query and hoped someone here might have some clue’s for me..

I have 2 tables “Users” and “files”.

Users:

id, name, address, etc..

Files:
id, user_id, file_name, etc..

I want to select all rows from Users and in the result create a last column that has a count of all file with where User.id = Files.user_id.

I tried SELECT * from Users UNION(SELECT COUNT Files.user_id WHERE Users.id = Files.user_id) but doesn’t work of course..

  • 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-18T21:12:32+00:00Added an answer on May 18, 2026 at 9:12 pm
    select u.*, count(f.id)
    from users u
    left join files f on u.id = f.user_id
    group by u.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am still trying to figure out the right architecture for a complex ASP.NET
I'm trying to figure out the best practice for implementing a complex algorithm on
I'm trying to figure out the best way to put complex numbers into my
I'm trying to figure out my first more complex SQL application and am having
I am trying to figure out how to merge two complex object instances using
I am trying to figure out how to use complex numbers in both my
I am trying to figure out how to write the following Mongo query in
I'm trying to figure out a simple to draw some text in OpenGL. My
I'm trying to figure out how to send a complex object through javascript to
Im trying to figure out if there's a way to add a shadow (complex

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.