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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:22:17+00:00 2026-05-25T23:22:17+00:00

This has me confused, I’m getting NULL columns for this query even though the

  • 0

This has me confused, I’m getting NULL columns for this query even though the table movie_image doesn’t have any NULL values in the column mi.filename.

SELECT m.*, mi.filename, COUNT(p.movieid) AS publicationsCount
                FROM movies m
           LEFT JOIN (movie_publications p, movie_image mi)
                  ON (m.movieid = p.movieid
                      AND
                      p.movieid = mi.movieid)
               GROUP BY m.movieid
  • 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-25T23:22:18+00:00Added an answer on May 25, 2026 at 11:22 pm

    A left Join will take all rows from the first table (movies) and try to match with the second table (movie_publications). When it’s not possible NULL columns will be inserted instead of the columns of the second table.

    If you don’t want this to happen you should use an INNER JOIN.

    UPDATE: you said in the comments that movies can have or not publication, but will always have an image, so you could rewrite the query as follows. In case you’re not totally sure that all movies have an image you could use LEFT JOIN also for movie_image.

    SELECT m.*, mi.filename, COUNT(p.movieid) AS publicationsCount
        FROM movies m
        LEFT JOIN movie_publications p
            ON (m.movieid = p.movieid)
        INNER JOIN movie_image mi
            ON (m.movieid = mi.movieid)
        GROUP BY m.movieid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This section has me thoroughly confused. I have an example problem that I am
I'm pretty new to Java and this has me really confused. I have two
This has confused me, I have the title error on the join in the
This one has me rather confused. I've written a query which runs fine from
This has always confused me. It seems like this would be nicer: ["Hello", "world"].join("-")
I don't think this question has been asked before. I'm a bit confused on
This isn't a code question for once, but it definitely has me confused. Basically,
This has been an adventure. I started with the looping duplicate query located in
This has been driving me crazy for a few days. Why doesn't the following
This has got me all confused! I'm trying to return the max value from

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.