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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:11:59+00:00 2026-05-23T12:11:59+00:00

here is my query which has a few joins and all works well except

  • 0

here is my query which has a few joins and all works well except the GROUP_CONCAT(p.product_id) and the SUM(p.price) portion.

SELECT ts.name as main_name, tp.class_id, ts.step_number, GROUP_CONCAT(p.product_id) as product_id, SUM(p.price) as price
from template as t 
JOIN template_step as ts on ts.template_id=t.template_id 
JOIN template_product as tp on tp.template_id=ts.template_id 
JOIN product as p on p.product_id=tp.product_id 
JOIN product_description as pd on pd.product_id=p.product_id 
where t.template_id = '59' 
group by tp.class_id, ts.step_number 
ORDER by ts.step_number, tp.class_id

The problem is that the elements returned the product_ids and the sum field are repeating

Here is my data from the query

Networking  1   1    88,156,151,275,48,101,274,133,154,125,135,148,63,63    3070.0000
Networking  2   1    275,235,164,274,154,124,169,148,62,98,62,277,191,270   3695.0000
Networking  3   1    92,98,216,181,133,187,272,154,274,148,126,62,62,165    4970.0000
Back Office 1   2    63,88,156,151,275,48,101,274,133,154,125,135,148,63    3070.0000
Back Office 2   2    275,235,164,274,154,124,169,148,62,98,62,277,191,270   3695.0000
Back Office 3   2    62,165,92,98,216,181,133,187,272,154,274,148,126,62    4970.0000
Data Back   1   3    148,63,63,88,156,151,275,48,101,274,133,154,125,135    3070.0000
Data Back   2   3    270,275,235,164,274,154,124,169,148,62,98,62,277,191   3695.0000
Data Back   3   3    62,62,165,92,98,216,181,133,187,272,154,274,148,126    4970.0000
Kitchen     1   4    135,148,63,63,88,156,151,275,48,101,274,133,154,125    3070.0000

There should be only 1 or 2 product_id returned for each class. If there is any other information I can give to help others help me I can provide anything..db structure ..ext..

  • 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-23T12:12:00+00:00Added an answer on May 23, 2026 at 12:12 pm

    GROUP_CONCAT() will not remove duplicate rows unless you use DISTINCT:

    GROUP_CONCAT([DISTINCT] expr [,expr ...]
                 [ORDER BY {unsigned_integer | col_name | expr}
                     [ASC | DESC] [,col_name ...]]
                 [SEPARATOR str_val])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query which does a number of joins and has a few
Here is the query which will get me all the contacts have HD quality
I have this query which works correctly in MySQL. More background on it here
SQL server 2008 Hello here is my query which returns the result SELECT *
I have a URI here in which a simple document.cookie query through the console
I've created a query in Linq-to-entities (4.0), which has me confused, as I join
Here's a scenario: I have a java front end (RCP/SWT) app which currently has
If we use the Limit clause in a query which also has ORDER BY
Here's my problem: In my database I have a requests table, which has a
I'm stuck with another coordinates related query here. I have a number of CSV

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.