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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:51:32+00:00 2026-05-21T12:51:32+00:00

table: id p_name p_price 1 tan 1 2 soap 1 3 pro tan 01

  • 0
table:
id   p_name      p_price
1    tan           1
2    soap          1
3    pro tan 01    2 
4    pro tan 02    3 
5    pro tan 03    4

How do I group the products that contain pro tan, something what I want for the html result

product name     price
tan                1
soap               1
pro tan            9

php:

$q_products = $db->query("SELECT * FROM p_products 
                          GROUP BY p_name 
                          HAVING LIKE 'pro tan%'"); 
// follow by while loop for echoing
  • 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-21T12:51:32+00:00Added an answer on May 21, 2026 at 12:51 pm
    select s.p_name, sum(s.p_price) 
    from 
      (select left(p_name, 7) as p_name, 
       p_price from products) s
    group by s.p_name;
    

    should do what you want.

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

Sidebar

Related Questions

for example: the table named products there is a product name field in the
I have a html table that I am populating with PHP, now it is
I have a table that is created dynamically, and I want to put an
How do you explicitally tell EF that a table lies in a specific schema?
I am trying to get a list of Products that share the Category. NHibernate
I have a web user control, that has a table with 3 columns 1)
I have 2 tables, defined as such: CREATE TABLE `product` ( `pid` SMALLINT( 5
I have two table The table structure goes something like this Table A ╔══════╦════════╗
What i want to do is get the details of each product from my
I have quite a massive query that I want to optimize, it consists of

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.