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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:37:06+00:00 2026-06-13T16:37:06+00:00

I created this select query to get some rows… Its working. but my problem

  • 0

I created this select query to get some rows… Its working. but my problem is I need to remove duplicate rows from the query…

this is my query:

SELECT tcs.tutor_id, tcs.category_id, tcs.subject_id, s.subjects, t.tutor_name, t.tutor_code
FROM tutor_category_subject as tcs
INNER JOIN subject AS s ON tcs.subject_id = s.subject_id
INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id
WHERE s.subjects LIKE '%business%';

This is its output:

    +----------+-------------+------------+------------------+-------------------+-----------+ 

| tutor_id | category_id | subject_id | subjects         | tutor_name        | tutor_code|

+----------+-------------+------------+------------------+-------------------+-----------+

|        1 |           6 |         37 | Business Studies | Tharanga Nuwan    |      1250 |
|        3 |           6 |         37 | Business Studies | Kumara            |      1252 | 
|       15 |           4 |         11 | Business & Accou | Tharanga Nuwan    |      1264 | 
|       15 |           6 |         37 | Business Studies | Tharanga Nuwan    |      1264 |
|       16 |           5 |         11 | Business & Accou | Kasun Kalhara     |      1265 | 
|       16 |           6 |         37 | Business Studies | Kasun Kalhara     |      1265 |

Here, you can see tutor id has duplicated in my query. and I need to select all subjects to a tutor in one row separated by comma.

eg: (Business & Accounting Studies, Business Studies) like this..

So can anybody tell me what I need to do in my select query??

Thank you.

This is my expecting result

+----------+-------------+------------+-------------------------------------------------+-----------------------+------------+
| tutor_id | category_id | subject_id | subjects                                        | tutor_name            | tutor_code |
+----------+-------------+------------+-------------------------------------------------+-----------------------+------------+
|       16 |           5 |         11 | Business & Accounting Studies, Business Studies | Kasun Kalhara         |       1265 |
|        3 |           6 |         37 | Business Studies                                | Kumara                |       1252 |
|        1 |           6 |         37 | Business Studies, Business & Accounting Studies | Tharanga Nuwan Kumara |       1250 |
+----------+-------------+------------+-------------------------------------------------+-----------------------+------------+
  • 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-13T16:37:07+00:00Added an answer on June 13, 2026 at 4:37 pm
    SELECT tcs.tutor_id, tcs.category_id, tcs.subject_id, GROUP_CONCAT(s.subjects) AS subjects,  t.tutor_name, t.tutor_code
    FROM tutor_category_subject as tcs
    INNER JOIN subject AS s ON tcs.subject_id = s.subject_id
    INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id
    WHERE s.subjects LIKE '%business%'
    GROUP BY t.tutor_name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big table with 10M rows. And I need to get some
I'm stuck with a seemingly easy query, but couldn't manage to get it working
hoping to get some help with this query, I've worked at it for a
I've created some TracReports but trying to do them with SQL, I don't get
I create a json encode in PHP like this: $get = mysql_query(SELECT * FROM
This is my query, CREATE VIEW employee_vu AS( SELECT employee_id,last_name employee,department_id FROM employees); I
Here is my table in the dataset: SELECT tag_work_field.* FROM tag_work_field I created this
(Using MySQL 4.1.22) I can't get this query of mine to use an index
I had posted other questions relating to this problem, but haven't had any responses
There are some topics narrowing my problem, but no one permits me to solve

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.