0

1,the Scenario is this i have a CV Builder project that receives the user personal information i.e. Name,Email.Phone_No etc and saves it against a unique Id In a Main table i.e. Personal_Information...

2,then it receives User's Academic information i.e.Degree_Level( Matriculation,Intermediate,bachelors etc), Degree Name(Bachelors in Software engineering)etc... And save this Info In a separate table having User_Id from Main Table as a Foreign Key. 3,then User enters his professional history in which he has to mention his projects too...Here comes the problem then(NOTE this information is also saved in a separate table having User_id from Main table as Foreign key in it)..

when a user enters more than 1 Professional_projects and i use INNER JOINS to select all records from all Tables against a single User_Id

but for 2 or more Professional_projects his academic _Information repeats for every entry of Professional_projects i.e. if user has entered 3 levels of degree (Metric,Intermediate,Bachelors) then these 3 levels are shown firstly for 1st Professional_project then again for 2nd Professional_Project and for third too if he enters the #rd project... Records multiplies with(No of Degree Level* No of projects) I just want to have 3 records of Degree Level only

1
  • Have you tried anything ???? Then please put it here... Jan 9, 2014 at 6:13

1 Answer 1

0

If I understand correctly this is what you have or part of what you have:

User Table

id col2
1  A

Degrees Table

id col2 userid
1  G    1
2  P    1

Projects Table
id col2 userid
1  Q    1
2  F    1

Result of Join

 Userid  Degree  Project
    1       1       1
    1       2       1
    1       1       2
    1       2       2 

The way these tables are set, you will always get duplicates. The best way is to run two queries, one for degrees and another for projects, then you can present the information the way you want it.

If you really like your join and want to run only one query, then again you have to set up some conditions in your code to eliminate duplicates.

I really do not see a point in joining projects and degrees. It seems unnecessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.