August 9, 2011 at 1:48 am
Hi guys,
Please can you look at my issue bellow
I have 4 table
1.biodata
----------------
username pk
password
firstname
lastnam
2.qualification
--------------
qualID
username
school
degree
3.application
--------------
appid
vacid
username
4.vacancy
-------------------
vacid
vacname
I created a view
SELECT dbo.biodata.UserName, dbo.biodata.FirstName, dbo.biodata.LastName, dbo.application.VacID,
dbo.vacancy.VacName,
dbo.qualification.Degree
FROM dbo.biodata INNER JOIN
dbo.application ON dbo.biodata.UserName = dbo.application.Username INNER JOIN
dbo.vacancy ON dbo.application.VacancyID = dbo.vacancy.VacancyID INNER JOIN
dbo.qualification ON dbo.biodata.UserName = dbo.qualification.UserName
You can have only 1 application but multiple qualification.
my problem is i want to display one record for each person even if you have multiple qualification
what i get now is
UserName FirstName LastName VacID vacancy Degree
-----------------------------------------------------------
joyr Joy Rice 1 Accountant Bsc
joyr Joy Rice 1 Accountant Bed
mikeL Mike Long 1 Accountant Bsc
but i want 2 see is
UserName FirstName LastName VacID vacancy Degree
-----------------------------------------------------------
joyr Joy Rice 1 Accountant Bsc
mikeL Mike Long 1 Accountant Bsc
What do i do??
August 9, 2011 at 2:24 am
uche_ezeribe (8/9/2011)
...what i get now is
UserName FirstName LastName VacID vacancy Degree
-----------------------------------------------------------
joyr Joy Rice 1 Accountant Bsc
joyr Joy Rice 1 Accountant Bed
mikeL Mike Long 1 Accountant Bsc
but i want 2 see is
UserName FirstName LastName VacID vacancy Degree
-----------------------------------------------------------
joyr Joy Rice 1 Accountant Bsc
mikeL Mike Long 1 Accountant Bsc
What do i do??
First thing you have to do is figure out the rules for deciding which degree to display. Joy Rice has BSc and BEd, how did you arrive at BSc in the lower result set? Why not display them all like this:
UserName FirstName LastName VacID vacancy Degree
-----------------------------------------------------------
joyr Joy Rice 1 Accountant BSc, BEd
mikeL Mike Long 1 Accountant Bsc
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
August 9, 2011 at 3:08 am
August 9, 2011 at 5:23 am
{Edit} Sorry... wrong thread...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply