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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:52:39+00:00 2026-05-23T02:52:39+00:00

I have this query select ts.name as my_name, ss.step_number, p.specs, p.price, ssp.class_id from optional_system_step

  • 0

I have this query

select ts.name as my_name, ss.step_number, p.specs, p.price, 
ssp.class_id from optional_system_step 
as ss join system as s on s.system_id=ss.system_id join category_description 
as cd on cd.category_id=ss.category_id join optional_system_step_product as 
ssp on ss.system_step_id=ssp.system_step_id join product as p on 
p.product_id=ssp.product_id join product_description as pd on 
pd.product_id=p.product_id join template_step as ts on 
(ts.template_id=s.optional_template_id and ts.step_number=ss.step_number)
where s.system_id = '15'  order by ss.step_number, ssp.class_id;

which returns this

admin   1       999.0000    1   
admin   1       1349.0000   1   
admin   1       1699.0000   1   
pay 1       479.0000    2   
pay 1       149.0000    2   
pay 1       269.0000    3   

Seems good but the problem is that i need to group by class_id but in the price field i need to add the three prices so for example i would have these two rows returned

admin   1       4047.0000   1   
pay 1   897.0000    2

So basically i want to add the three numbers together and return that value in the price field

  • 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-23T02:52:40+00:00Added an answer on May 23, 2026 at 2:52 am

    USE the aggregate function SUM() with GROUP BY:

    select ts.name as my_name, ss.step_number, p.specs, SUM(p.price),  ssp.class_id
    from optional_system_step  as ss
    join system as s on s.system_id=ss.system_id
    join category_description  as cd on cd.category_id=ss.category_id
    join optional_system_step_product as  ssp on ss.system_step_id=ssp.system_step_id
    join product as p on  p.product_id=ssp.product_id
    join product_description as pd on  pd.product_id=p.product_id
    join template_step as ts on  (ts.template_id=s.optional_template_id and ts.step_number=ss.step_number)
    where s.system_id = '15' 
    GROUP BY ts.name, ss.step_number, p.spects, ssp.class_id
    order by ss.step_number, ssp.class_id; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this working query: $q = $this->db->query('SELECT u.name FROM users u JOIN user_group
I have this query: SELECT groups.name categories.name, categories.label FROM groups JOIN categories ON (categories.group1
i have this sql query select * from table where name like ? but
I have a query like this: select empno,name from emp where job = 'CLERK'
I have a query like this SELECT TOWN, NAME FROM CINEMA WHERE CITY_ID =
I have this query: SELECT p.text,se.name,s.sub_name,SUM((p.volume / (SELECT SUM(p.volume) FROM phrase p WHERE p.volume
I have this query that works: select name, location_id from all_names where location_id in
I have this query: SELECT name, lastname FROM contestant WHERE name= 'John' AND lastname
I have this query: SELECT Items.Name, tblBooks.AuthorLastName, tblBooks.AuthorFirstName FROM Items WHERE Items.ProductCode IN (
I have this query select * from alldistros t1 LEFT join origin t2 on

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.