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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:41:21+00:00 2026-06-11T09:41:21+00:00

I am trying to do a couple of JOINS in my sql query but

  • 0

I am trying to do a couple of JOINS in my sql query but have run into a problem. What i need to do is select all fields from the poker_sites table then grab 2 relative fields from networks and if it is available get the average rating from editor_content

The problem i am having is the query is only returning one row when there should be at least three.

Any help would be much appreciated.

here is my SQL

SELECT AVG(editor_content.rating) AS rating, poker_sites.*,
networks.network_name, networks.network_icon FROM poker_sites
    LEFT JOIN networks
    ON (poker_sites.network_id=networks.network_id)
    LEFT JOIN editor_content
    ON (poker_sites.site_id=editor_content.assign_id)
    WHERE poker_sites.published=1
  • 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-11T09:41:22+00:00Added an answer on June 11, 2026 at 9:41 am

    You need GROUP BY if you want to get multiple results with an aggregate function (in this case AVG).

        SELECT x.avgRating AS rating, poker_sites.*,
            networks.network_name, networks.network_icon 
        FROM poker_sites
        LEFT JOIN networks
            ON (poker_sites.network_id=networks.network_id)
        LEFT JOIN 
        (
            SELECT AVG(editor_content.rating) as avgRating, editor_content.assign_id
            FROM editor_content
            GROUP BY editor_content.assign_id
        ) x
            ON (poker_sites.site_id = x.assign_id)
        WHERE poker_sites.published=1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem trying to do a couple of things with linq joins...
I have a working sql query that I have been trying to convert to
So I have a SQL Query as Follows SELECT P.Date, P.CategoryName, P.ProductName, SUM(Quantity) Quantity,
I have an NHibernate detached criteria query which has a couple of inner joins,
I am trying a couple of tutorials from http://nehe.gamedev.net , in order to learn
So I have been working and trying for a couple of hours. I am
we're building a scheduler system and have a couple of situations where we're trying
Trying to get a simple COUNT from a table that takes a couple of
I have some trouble trying to join a couple of tables for a time-booking
I am trying to import data from a large database. I have two tables

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.