A little rusty on this however, 
you can join 2 tables which are the
same such as show below. However, 
you may want to check the syntax.

Select CD1.CandidateID, Count(CD1.*) AS num_skills, Sum(CD2.ExpYears) AS
BM_score
>From CandidateSkills CD1
        left join CandidateSkills CD2 on 
        ( 
        CD1.CandidateID = CD2.CandidateID
        AND CD2.SkillID in (#skills1#,#skills2#,#skills3#)
        )
Where CD1.CandidateID IN (#ListCandidateID#)




-----Original Message-----
From: Jason Lotz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 25, 2001 12:49 PM
To: CF-Talk
Subject: Re: Query Join Brain Fart


How can you do a join on the same table?  Both of these queries are drawn
from the CandidateSkills table?  Am I misunderstanding your question?

----- Original Message -----
From: "cassady " <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, April 25, 2001 9:22 AM
Subject: Query Join Brain Fart


> Hey everyone -
> Arrgh. I haven't done any of these in a while, and I'm having a little bit
of a brain fart. Could somebody put these together in a join when the SQL
table returned has the following columns:
>
> CandidateID, Num_Skills, BM_score
>
> If I get the example then I think (hope? dream?) that my brain might start
functioning again like it should. :-)
>
>
> <!--- For Number of Skills --->
> <cfquery name="q_BM_score" datasource="datasource">
> Select CandidateID, Count(*) AS num_skills
> From CandidateSkills
> Where CandidateSkills.CandidateID IN (#ListCandidateID#)
> Group By CandidateID
> </cfquery>
>
>
> <!--- Query for skill points --->
> <cfquery name="q_BM_score" datasource="datasource">
> Select Sum(ExpYears) AS BM_score
> From CandidateSkills
> Where CandidateSkills.CandidateID = #Client_saSearch.CandidateID#
> AND ((CandidateSkills.SkillID = #Skills1#)
> OR (CandidateSkills.SkillID = #Skills2#)
> OR (CandidateSkills.SkillID = #Skills3#))
> </cfquery>
>
> Thank you for your time in advance,
> Stephen R. Cassady
> [EMAIL PROTECTED]
> http://www.ububik.com
> http://www.tallylist.com <--- cause' you no you wannnnnnnna!
>
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to