Link to home
Start Free TrialLog in
Avatar of smfmetro10
smfmetro10Flag for United States of America

asked on

how do i join three tables

Hi,
I have a query that has two joined tables but now I need to join another table with the ability to delete files.

Here is my code so far:

How do I join tblCandidatePortfolioProjectLinks with column names of (link_id, req_part_id, text_title, description)

Thanks!
<cfquery name="qcheck" datasource="#APPLICATION.datasource#">
SELECT f.[file_id], f.extension, v.candidate_id 
FROM tblCandidatePortfolioProjectFiles f
INNER JOIN vwCandidatePortfolioProjects v
      ON f.req_part_id = v.req_part_id
      AND v.submitted IS NULL
WHERE v.constitid = #SESSION.current_user.constitid# AND f.[file_id] = <cfqueryparam value="#Form.id#" cfsqltype="cf_sql_integer">
</cfquery>

<cfif qcheck.recordcount eq 1>
	<cfset thisDir = "#APPLICATION.upload_dir##qcheck.candidate_id#">
    <cffile action="delete" file="\#thisDir#\worksample_#qcheck.file_id#.#qcheck.extension#">
    <cfif FileExists("\#thisDir#\worksample_T#qcheck.file_id#.#qcheck.extension#")>
    
    	<cffile action="delete" file="\#thisDir#\worksample_T#qcheck.file_id#.#qcheck.extension#">
    </cfif>
    <cfquery name="qdelete_files" datasource="#APPLICATION.datasource#">
    DELETE FROM tblCandidatePortfolioProjectFiles where file_id = <cfqueryparam value="#id#" cfsqltype="cf_sql_integer">
    </cfquery>
  

<cfelse>
	Can not delete file
</cfif>

Open in new window

Avatar of gdemaria
gdemaria
Flag of United States of America image

> I have a query that has two joined tables but now I need to join another table with the ability to delete files.

This doesn't really make sense... can you rephrase this please?

Keep in mind that you know your application, we don't know it at all... you have to be specific about what you want to do and to what..

ASKER CERTIFIED SOLUTION
Avatar of billfusion
billfusion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smfmetro10

ASKER

great thanks!