I believe I am getting the hang of the left outer join, but I am not there yet.
I have the same devotional that goes out to several clients which have the option of making changes to the devotional before it goes out.
For example I have 3 clients and one of them changed the devotional. So two of them will get the original devotional and the third company will get the modified version.
I’ve been able to figure out how to get the modified version to go out, but the 2 other clients are getting the modified version instead of the original.
<!--- get subscribers timezone and layout options, ie: header and color combinations --->
<cfquery name="getClients" datasource="#application.dsn#">
select *
from (subscriber INNER JOIN contacts ON subscriber.contact_id = contacts.contact_id) INNER JOIN layout ON contacts.contact_id = layout.contact_id
where subscriber.timezone = '4'
</cfquery>
<!--- determine which version of the devotional is available for this day --->
<cfquery name="getDevotional" datasource="#application.dsn#">
SELECT mobile.mob_id, mobile.display_date, mobile.title, mobile.body, mobile.scripture,edited.edit_id,edited.contact_id,edited.etitle,edite d.escripture,edited.ebody
<!--- Mobile table holds the devotionals & Edited table holds the altrered devotionals --->
FROM mobile
left outer join edited ON mobile.mob_id = edited.mob_id
where mobile.display_date = <cfqueryparam value ="#dateformat(now(), "YYYY-MM-DD")#" cfsqltype="cf_sql_date">
</cfquery>
Simplified output version:
<cfoutput>
<cfloop query="getClients">
<cfif getDevotional.edit_id GT "">#etitle#<cfelse>#title#</cfif>
</cfloop>
</cfoutput>
What step am I missing?