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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:08:22+00:00 2026-05-26T14:08:22+00:00

I have the following query: SELECT ev.q1, ev.comments, es.session_number, es.title, CONCAT( np.first_name, ‘ ‘,

  • 0

I have the following query:

SELECT ev.q1, ev.comments, es.session_number, es.title, CONCAT( np.first_name,  ' ', np.last_name ) AS speaker
FROM  `expo_session_eval` ev
LEFT JOIN expo_session es ON es.session_id = ev.session_id
LEFT JOIN expo_session_speaker ess ON ess.session_id = ev.session_id
LEFT JOIN expo_speaker sp ON sp.speaker_id = ess.speaker_id
LEFT JOIN new_people np ON np.id = sp.people_id
GROUP BY CONCAT( np.first_name,  ' ', np.last_name ) 
ORDER BY es.session_number

This returns data that looks like this:

session_id  q1  comments    session_number  title               speaker
===================================================================================
169         3   Good!       103            Digital Practices      Steve Bullock
169         3   Good!       103            Digital Practices      Sheila Bacon
170         1               104            LBS = Location Based   Patrick Moorhead

This is correct in that there are two records in expo_session_eval for session_id 169, but it’s incorrect in that the q1 and comments values are not identical. There are two records in expo_session_speaker that correspond to session_id 169 – i.e. there are two speakers for this one session.

Ideally, I’d like my results to look like this:

session_id  q1  comments    session_number  title                  speaker
===============================================================================================
169         3   Good!       103            Digital Practices        Steve Bullock, Sheila Bacon
169         5   Great!      103            Digital Practices        Steve Bullock, Sheila Bacon
170         1               104            LBS = Location Based     Patrick Moorhead

I’ve tried using GROUP_CONCAT, but apparently I’m not using it correctly, because when I use this query:

SELECT ev.session_id, ev.q1, ev.comments, es.session_number, es.title, GROUP_CONCAT( CONCAT( np.first_name,  ' ', np.last_name ) ) AS speaker
FROM  `expo_session_eval` ev
LEFT JOIN expo_session es ON es.session_id = ev.session_id
LEFT JOIN expo_session_speaker ess ON ess.session_id = ev.session_id
LEFT JOIN expo_speaker sp ON sp.speaker_id = ess.speaker_id
LEFT JOIN new_people np ON np.id = sp.people_id
ORDER BY es.session_number

I get this:

session_id  q1  comments    session_number  title                  speaker
===============================================================================================
169         3   Good!       103         Digital Practices   Steve Bullock,Sheila Bacon,Patrick Moorhead

What do I need to do to make the speaker column group_concat within the session_id?

EDITS FOR @NOAH

Main table is expo_session_eval – each record has a session_id stored. These IDs come from a table called expo_session. There’s a cross-reference table called expo_session_speaker that contains only two columns – session_id and speaker_id. There’s another table called speaker_id that contains speaker_id and people_id. people_id links the table to a table called new_people, which contains first_name and last_name.

In expo_session_speaker, there can be multiple records for a given session_id – each record corresponds to a single session and a single speaker. So to display ALL speakers for a given session, you end up with multiple records. That’s where the group by/group_concat idea came in; I need to display ALL the speakers for a given session in ALL records for that session. Hence, session 169 record 1 speakers are Steve Bullock, Sheila Bacon, and session 169 record 2 speakers are the same, even though none of the other selected values will be the same for the two session 169 records.

(Clear as mud, right?)

  • 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-26T14:08:22+00:00Added an answer on May 26, 2026 at 2:08 pm

    Something like this should do what you want –

    SELECT ev.session_id, ev.q1, ev.comments, es.session_number, es.title, speaker
    FROM  `expo_session_eval` ev
    LEFT JOIN expo_session es ON es.session_id = ev.session_id
    LEFT JOIN (
        SELECT ess.session_id, GROUP_CONCAT( CONCAT( np.first_name,  ' ', np.last_name ) ) AS speaker
        FROM new_people np
        LEFT JOIN expo_speaker sp ON  np.id = sp.people_id
        LEFT JOIN expo_session_speaker ess ON sp.speaker_id = ess.speaker_id
        GROUP BY ess.session_id
    ) np ON np.session_id = es.session_id   
    ORDER BY es.session_number
    

    You don’t actually want to use a GROUP BY statement on the entire result set, just to create a concatenated string of the speakers so it needs to be done in a subquery.

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

Sidebar

Related Questions

I have the following query SELECT e.topicShortName, d.catalogFileID, e.topicID FROM catalog_topics a LEFT JOIN
I have the following SQL query select s.comments + s.further_comments from dbo.samples s where
I have following SQL query SELECT TOP 10000 AVG(DailyNodeAvailability.Availability) AS AVERAGE_of_Availability FROM Nodes INNER
I have the following query: SELECT COUNT(*) FROM FirstTable ft INNER JOIN SecondTable st
I have the following query: SELECT o.id,o.name FROM object o WHERE ( o.description LIKE
I have the following query SELECT * FROM attend RIGHT OUTER JOIN noattend ON
I have the following query: SELECT DISTINCT w.name, count(*) FROM widgets AS w JOIN
I have the following query: SELECT * FROM quotes INNER JOIN quotes_panels ON quotes.wp_user_id
I have the following query: select p from Plan as p where p.location =
I have the following query: SELECT location, step, COUNT(*), AVG(foo), YEAR(start), MONTH(start), DAY(start) 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.