Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex query

Status
Not open for further replies.

adwanoy

MIS
Apr 10, 2006
37
US
Hey Guys,
I have a query which is very complicated, but I got most of it, i stuck with this: the table has a field keyword, I want the the query to return among all the records that share the same keyword to return just one of them

example
field keyword
------ -------
1 fun
2 travel
3 fun
4 fun
5 entertainment
5 travel

only return record, 1, 2, 5

this is my query

SELECT TaskCompetency.CompetencyID, Competency.CompetencyDescription, JobTask.JobID, PositionTask.PositionID, ActivityTask.GroupID, Competency.CompetencyPriority, "" AS Rating INTO Temp
FROM (((Task LEFT JOIN ActivityTask ON Task.TaskID = ActivityTask.TaskID) LEFT JOIN JobTask ON Task.TaskID = JobTask.TaskID) LEFT JOIN PositionTask ON Task.TaskID = PositionTask.TaskID) INNER JOIN (Competency INNER JOIN TaskCompetency ON Competency.CompetencyID = TaskCompetency.CompetencyID) ON Task.TaskID = TaskCompetency.TaskID
WHERE (((JobTask.JobID)=[forms]![perfevalheader]![jobname]) AND ((Competency.CompetencyPriority)=[forms]![perfevalheader]![Priority])) OR (((PositionTask.PositionID)=[forms]![perfevalheader]![Positionname]) AND ((Competency.CompetencyPriority)=[forms]![perfevalheader]![Priority])) OR (((ActivityTask.GroupID)=9) AND ((Competency.CompetencyPriority)=[forms]![perfevalheader]![Priority]));

Thanks
 
What is your "keyword" field ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
well, it is gonna be either numeric or string
but I like numeric
 
Well, I rephrase my question.
What are the actual result of your query and the expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top