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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:51:27+00:00 2026-05-27T00:51:27+00:00

I have this query that I’m running against mysql: SELECT video.title AS title, video.url

  • 0

I have this query that I’m running against mysql:

SELECT video.title AS title, 
       video.url AS url, 
       video.id AS id, 
       video.description AS description,
       avg(BodyPartsVideosUser.rating) AS rating 
FROM videos AS video  
   LEFT JOIN body_parts_videos as BodyPartsVideo on BodyPartsVideo.video_id = video.id 
   LEFT JOIN  body_parts_videos_users as BodyPartsVideosUser on BodyPartsVideo.id = BodyPartsVideosUser.body_parts_video_id 
WHERE BodyPartsVideo.body_part_id =  39  
GROUP BY BodyPartsVideosUser.body_parts_video_id 
ORDER BY rating DESC ;

Now, the problem is that I get back one row with this query.

However, my videos table has three totally distinct entries, and my body_parts_videos table has three entries corresponding to the videos table. However, the body_part_id column there is 39 for each entry.

the body_parts_videos_users table is empty.

How do i alter this query so i get all three row returned?

body_parts_videos:

+----+--------------+----------+
| id | body_part_id | video_id |
+----+--------------+----------+
|  1 |           39 |       26 |
|  3 |           39 |       28 |
|  4 |           39 |       29 |
+----+--------------+----------+

videos:

+----+---------+-------------+--------------------------------------+-------------+----------
| id | title   | description | user_id  | url         | filename | created    | modified   |
+----+---------+-------------+--------------------------------------+-------------+----------
| 26 | new vid | dd          | 1        | eMvu0Cbi040 | a.avi    | 2011-11-23 | 2011-11-23 |
| 28 | new vid | dd          | 2        | ETyBso2SHJM | b.avi    | 2011-11-23 | 2011-11-23 |
| 29 | title   | ddd         | 3        | 2Ud41iWKUIg | c.avi    | 2011-11-23 | 2011-11-23 |
+----+---------+-------------+--------------------------------------+-------------+----------

body_parts_videos_users:
empty

I want to select from the empty body_parts_videos_users table because, when there are results, I want them to appear first. The empty row magically becomes zero somehow, but I’m fine with that.

Any ideas what I’m doing wrong? Oh! Here is what i get when i run the query:

+---------+-------------+----+-------------+--------+-
| title   | url         | id | description | rating | 
+---------+-------------+----+-------------+--------+-
| new vid | eMvu0Cbi040 | 26 | dd          |   NULL | 
+---------+-------------+----+-------------+--------+-

Here’s what i’d expect:

+---------+-------------+----+-------------+--------+-
| title   | url         | id | description | rating | 
+---------+-------------+----+-------------+--------+-
| new vid | eMvu0Cbi040 | 26 | dd          |   NULL | 
+---------+-------------+----+-------------+--------+-
| new vid | ETyBso2SHJM | 28 | dd          |   NULL | 
+---------+-------------+----+-------------+--------+-
| title   | 2Ud41iWKUIg | 29 | ddd         |   NULL | 
+---------+-------------+----+-------------+--------+-

Any help is much appreciated!

  • 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-27T00:51:27+00:00Added an answer on May 27, 2026 at 12:51 am

    I think the problem is, that your body_parts_videos_users table is empty.
    change your GROUP BY to GROUP BY body_parts_videos.body_part_id,body_parts_videos.video_id

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this MySQL query that I'd like to optimize: SELECT min(`topic_id`) FROM `gallery_topics`
I have this query that I'm running in Java. select book from com where
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this working query that outputs URL and click counts from database. <?php
So I have this awesome MySQL query that's returning me an awesome array >
I have this query that (stripped right down) goes something like this : SELECT
I have this query that runs fine: SELECT Value FROM data WHERE MetaDataID =
I have this query that uses a UNION: $this->db->query(' SELECT DISTINCT users.user_pic, users.id, users.username,
I have this query that spawns the following error: SELECT * FROM Quota WHERE

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.