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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:58:47+00:00 2026-06-09T15:58:47+00:00

Got a small MySql problem I was hoping someone could take a look at.

  • 0

Got a small MySql problem I was hoping someone could take a look at.

Current Sql:

SELECT IFNULL(ua.total, 0) applications, 
       users_applications.job_id as job_id, 
       users.* 
FROM users_applications 
        LEFT OUTER JOIN users 
             on (users_applications.user_id = users.id) 
        LEFT OUTER JOIN ( 
                           SELECT COUNT(*) total, job_id, id 
                           FROM users_applications
                           GROUP BY job_id ) AS ua 
                  ON (users_applications.id = ua.id)

Which is great and it’s returning something like:

applications  |  job_id  |  user_id  |
-------------------------------
3     |   1001    |   1001  |
0     |   1001    |   1002  |
0     |   1001    |   1003  |
1     |   1003    |   1004  |
1     |   1003    |   1005  |
0     |   1004    |   1006  |

Although it is counting the number of applications for that job it’s only doing it for the first row, I’d like it to appear in every row instead of just a 0 for subsequent rows as it is at the moment.

Many 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-06-09T15:58:48+00:00Added an answer on June 9, 2026 at 3:58 pm

    Try this one.

    SELECT  c.totalCount,
            a.job_id,
            a.user_id
    FROM    users_applications a
                LEFT JOIN users b
                    ON a.user_ID = b.ID
                LEFT JOIN
                    (
                        SELECT job_ID, count(*) totalCount
                        FROM user_applications
                        GROUP BY job_ID
                    ) c on a.job_ID = c.jobID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

got a small little problem I'm hoping someone can help me with. I have
I've got a small problem (and it's probably seriously nothing). I have a small
I've got a small problem I'm struggling to solve. Let's say I've got an
I've got a small Cocoa problem. I have a StatusBar application that has an
Hi all got a small problem accessing a looped php variable. My script loops
got a small problem, this code <form action=<?php echo $_SERVER['PHP_SELF']; ?> method=post> <?php ...
I got a small problem . I have this date format from .net json
I got small problem when I add element to JList it resize itself. I
Basically, I'm writing a small forum script for an intranet. I've got 3 mysql
Got a small problem with some very basic jQuery, I'd like to be able

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.