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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:34:14+00:00 2026-05-15T03:34:14+00:00

I am currently working on a MySQL query that contains a table: TBL:lesson_fee -fee_type_id

  • 0

I am currently working on a MySQL query that contains a table:

TBL:lesson_fee
-fee_type_id (PRI)
-lesson_type_id (PRI)
-lesson_fee_amount

this table contains the fees for a particular ‘lesson type’ and there are different ‘fee names’ (fee_type). Which means that there can be many entries in this table for one ‘lesson type’

In my query I am joining this table onto the rest of the query via the ‘lesson_type’ table using:

lesson_fee 
INNER JOIN (other joins here)
ON lesson_fee.lesson_type_id = lesson_type.lesson_type_id

The problem with this is that it is currently returning duplicate data in the result. 1 row for every duplicate entry in the ‘lesson fee’ table.

I am also joining the ‘fee type’ table using this ‘fee_type_id’

Is there a way of telling MySQL to say “Join the lesson_fee table rows that have lesson_fee.lesson_type_id and fee_type_id = client.fee_type_id”.

UPDATE: Query:

SELECT
lesson_booking.lesson_booking_id,lesson_fee.lesson_fee_amount
FROM
fee_type INNER JOIN
        (lesson_fee INNER JOIN
                (color_code INNER JOIN
                                (employee INNER JOIN
                                        (horse_owned INNER JOIN
                                            (lesson_type INNER JOIN
                                                    (timetable INNER JOIN
                                                        (lesson_booking INNER JOIN CLIENT
                                                        ON
                                                        client.client_id = lesson_booking.client_id)
                                                    ON
                                                    lesson_booking.timetable_id = timetable.timetable_id)
                                            ON
                                            lesson_type.lesson_type_id = timetable.lesson_type_id)
                                        ON
                                        horse_owned.horse_owned_id = lesson_booking.horse_owned_id)
                                ON
                                employee.employee_id = timetable.employee_id)
                                ON
                                employee.color_code_id = color_code.color_code_id)
                ON
                lesson_fee.lesson_type_id = lesson_type.lesson_type_id)
        ON
        lesson_fee.fee_type_id = client.fee_type_id
WHERE booking_date = '2010-04-06'
ORDER BY lesson_booking_id ASC

Update: Output:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>query data</title>
<style type="text/css" <!--
.normal {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #000000}
.medium {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15px; font-weight: bold; color: #000000; text-decoration: none}
--></style>
</head>
<body>
<h3>query result</h3><table border=1>
<tr>
<td bgcolor=silver class='medium'>lesson_booking_id</td><td bgcolor=silver class='medium'>lesson_fee_amount</td></tr>
<tr>
<td class='normal' valign='top'>0</td>

<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>0</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>0</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>0</td>

<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>5</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>5</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>5</td>

<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>5</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>9</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>9</td>

<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>9</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>9</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>11</td>

<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>11</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>11</td>
<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>11</td>

<td class='normal' valign='top'>25.00</td>
</tr>
<tr>
<td class='normal' valign='top'>13</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>13</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>13</td>

<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>13</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>16</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>16</td>

<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>16</td>
<td class='normal' valign='top'>500.00</td>
</tr>
<tr>
<td class='normal' valign='top'>16</td>
<td class='normal' valign='top'>500.00</td>
</tr>
</table>
</body></html>
  • 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-15T03:34:15+00:00Added an answer on May 15, 2026 at 3:34 am

    It’s almost what you write in english

    “Join the lesson_fee table rows that have lesson_fee.lesson_type_id and fee_type_id = client.fee_type_id”.

    FROM lesson_fee 
    INNER JOIN client ON 
      lesson_fee.lesson_type_id=client_lesson_type_id AND  
      lesson_fee.fee_type_id=client.fee_type_id 
    

    Assuming lesson_fee (lesson_type_id,fee_type_id) is unique, then this will return one row from the lesson_fee table,rather than one for each fee type.

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

Sidebar

Related Questions

I am currently working on a web application that uses PHP and MySQL, but
I'm currently working on a PHP application that uses a MySQL database for its
I'm currently working on creating a new C# project that needs to interact with
I am currently creating a sorting method that consists of values from an mysql
I have a web application that I am currently working on that uses a
I currently working on an issue tracker for my company to help them keep
I am currently working on a project and my goal is to locate text
I am currently working on a project with specific requirements. A brief overview of
The system I am currently working on requires some role-based security, which is well
I'm currently working at a small web development company, we mostly do campaign sites

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.