0

so, basically i want to get data from the database. the data i want is a people/member without a match team name

in the registration form every member have to fill a team name and then select a category , lets say category A must have a 2 member for each team.

now i want a list of member which dont have a match team name.

how is the logic ?

what im thinking is :

  1. get a list of team name
  2. do a looping to check is there a member with the same team name and category ( num rows less than or exactly 1 )
  3. list the result

i haven't done any code , coz i'm confused with the logic on how i would do it .

hope you guys can help me .

Thanks

anyway i'm currently using codeigniter.

EDIT #1

so here is the table structure

ID | NAME | CATEGORY | TEAM 1 | Person 1 | CAT A | TEAM A 2 | PERSON 2 | CAT A | TEAM A 3 | PERSON 3 | CAT A | TEAM B

what i want in the result is someone without other team member, so the result would be :

3 | PERSON 3 | CAT A | TEAM B

because the other have a matching team

taek
  • 1,009
  • 3
  • 11
  • 14
  • 1
    posting table structure, sample data and expected results would help clarify your question. I believe you need to read up on the different join types. I think you can achieve what you're after by using an OUTER join between tables. but without structure, sample data and expected results I'm not positive. Great example of Joins can be found [on Coding Horror blog](http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/) – xQbert Oct 16 '15 at 18:11
  • thanks for the suggestion @xQbert – taek Oct 16 '15 at 18:59

0 Answers0