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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:47:09+00:00 2026-05-21T04:47:09+00:00

I have table structure like below: events (boxing, sparring etc) competitors (users who are

  • 0

I have table structure like below:

events (boxing, sparring etc)
competitors (users who are participating into diff events)
events_competitors (every competitor's selected events will go here)

Now what i want is, as per my match schedules i want to find competitors from schedules tables, where each competitors will be matching with events they have selected at registration time.

I’m using a find query something like this:

$matchdivisions = $this->Competitor->find("all" , array(
                                                'conditions' => array('Competitor.status' => 1, 
                                                'Competitor.payment_completed' => 1,
                                                'Competitor.weightgroup_id' => $current_matchsc['Matchschedule']['weightgroup_id'],
                                                'Competitor.rank_id' => $current_matchsc['Matchschedule']['rank_id'],
                                                'Competitor.degree_id' => $current_matchsc['Matchschedule']['degree_id'],
                                                'Competitor.gender' => $current_matchsc['Matchschedule']['gender'],

                                                        ),

                                            'joins' => array(

                                                     array('table' => 'event_competitors',
                                                           'alias' => 'EventCompetitor',
                                                           'type' => 'left',
                                                           'conditions'=> array('EventCompetitor.event_id = '.$current_matchsc['Event']['id']),
                                                          ) 
                                                        )
                                )
);

Here, I have used joins because I am not able to find relations from EventCompetitor matching with Competitors and Events.

Problem: The single matching record comes 10 times, because of join while it should be single time only.

Earliest reply would be appreciated.

Thanks in advance!

Now a next level once this worked for me:

I have two levels of conditions check, in EventsCompetitors I want to see, if they want to have a fight with black belt or if they are minor and they want to have fight with adults so in this case, I want to see these both flags and on that basis, again my conditions will be changed and a new results will be displayed for my additional displays.

Kindly let me know, if sometime anyone have idea on this kind of stuffs with CakePHP.

Again a lot thanks to stackoverflow for their excellent services !

  • 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-21T04:47:10+00:00Added an answer on May 21, 2026 at 4:47 am

    If you are only interested in a single record and are always sure that the others are duplicates then you can use find(‘first’, …) instead.

    If you are interested in multiple different records but you are getting multiples of each of those records you could add in a 'group' => array('') to aggregate the competitors on a specific field to only return them once ?

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

Sidebar

Related Questions

I have a table structure like below : categoryID bigint , primary key ,
I have a table structure like the one shown below: <table id=result> <tr> <td
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a table with a structure like the following: LocationID AccountNumber long-guid-here 12345
I have a table structure that looks like: <table> <tr id=row1> <td> <div>row 1
I have a table structure like this: <table1> <tbody> <tr> <td></td> ... <td> <table2>
I have a table structure looking something like this. One outer table and in
Consider I have a table, like below, that I am trying to populate with
I have a table structure for displaying posts like this: <table> <tr><td>heading of the
I have 2 tables: posts tags Tags table is structured like this: post_id tag

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.