<!--- 
 Filename: FilmCast2a.cfm
 Created by: Nate Weiss (NMW)
 Purpose: Demonstrates the use of SQL joins
--->

<!--- Retrieve Films and Related Actors from database --->
<cfquery name="getFilmInfo" datasource="#APPLICATION.dataSource#">
 SELECT 
 f.FilmID, f.MovieTitle, 
 a.NameFirst, a.NameLast
 FROM (Films f INNER JOIN 
 FilmsActors fa ON f.FilmID = fa.FilmID) INNER JOIN 
 Actors a ON fa.ActorID = a.ActorID
 ORDER BY f.MovieTitle, a.NameLast
</cfquery>

<html>
<head><title>Films and Actors</title></head>
<body>
<h2>Films And Actors</h2>

<!--- Display retrieved information in HTML table --->
<cftable query="getFilmInfo" htmltable border colheaders>
 <cfcol header="Film ID" text="#FilmID#">
 <cfcol header="Film Title" text="#MovieTitle#">
 <cfcol header="Actor (First Name)" text="#NameFirst#">
 <cfcol header="Actor (Last Name)" text="#NameLast#">
</cftable>

</body>
</html>
