Axelology
Posted At : November 4, 2006 7:24 PM | Posted By : Axel Jensen

Using Joins in sql

At work I always get confused on good practice of using joins... here is an example of a practical join.

<cfquery name="getConcernDetails" datasource="#regLabDSN#">

SELECT   
C.concernID, C.ClientID, C.DateCreated,
C.Status, C.ClientEmail, C.isConcern,
C.ownerID, C.ownerGroupID,            
a.userID, a.username, s.label

FROM
unmc_Concerns C JOIN WLTAdminusers a ON c.ownerID = a.userid
JOIN WLTsecurity s ON C.ownerGroupID = s.secid

WHERE
C.ConcernID = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.var_details#" />
ORDER BY
C.ConcernID

</cfquery>

Comments



Blog provided and hosted by CF Webtools. Blog Sofware by Ray Camden.