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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:39:02+00:00 2026-06-11T16:39:02+00:00

Here’s a picture of my database structure: When I input an Observation , I’m

  • 0

Here’s a picture of my database structure:

Observation recording - database structure

Criteria

When I input an Observation, I’m entering a row into Observations but also 0, 1 or more rows into Criteria.

I’m trying to write an SQL statement which allows me to select the Strongest 5 teachers in a specific criteria.

So for example I’d click on Questioning (which might have an ID of 5 in Criteria_Labels), I’d want to return a list of 5 teachers (Teacher_ID from Observations) who have the most rows of Criteria_ID = 5 in Criteria.

The statement that I’ve attempted to write is as follows:

SELECT t.Name AS Teacher_Name
FROM observations o
LEFT JOIN teachers t ON o.Teacher_ID = t.Teacher_ID
LEFT JOIN criteria c ON o.ID = c.Observation_ID
WHERE c.Criteria_ID = 5
ORDER BY COUNT(c.Criteria_ID) DESC
LIMIT 0,5

However, it only appears to return one member of staff. I’m not sure I’ve got this right at all, but hopefully I’m along the right lines.

Can anyone help? Thanks in advance,

  • 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-11T16:39:03+00:00Added an answer on June 11, 2026 at 4:39 pm
    SELECT t.Teacher_ID, t.Name AS Teacher_Name, count(*) as total
    FROM observations o
    LEFT JOIN teachers t ON o.Teacher_ID = t.Teacher_ID
    LEFT JOIN criteria c ON o.ID = c.Observation_ID
    WHERE c.Criteria_ID = 5
    group by t.Teacher_ID, t.Name
    order by total desc
    limit 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
here is my php code $titikPetaInti = array(); while($row = mysql_fetch_assoc($hasil2)) { $titikPetaInti[] =
Here's a part of my aspx page: <span id=drag>This can be dragged </span> <input
Here is my problem.. I have the option to create(add) two new input fields,
Here is my error(if you need any more info just ask)- Error SQL query:
Here's a problem I ran into recently. I have attributes strings of the form
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is an object that I'd like to use with ng-repeat, but it's not
Here's the code I'm running. Basically I scrape data, and place them into simple
Here is a XML: <mesh> <triangles material=face count=990> <input semantic=VERTEX source=#boyShape-skin-vertices offset=0/> <input semantic=NORMAL

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.