swansong77
Programmer
I have 2 tables MembTableA and MembTableB. If a MemberNumber exists on both tables I want to somehow put an alert in my coldfusion output (I have an example "CFIF" in my code below) - and only show the 1 result from MemberTableA. Below is my query and output - can someone assist?
Query in CFC
SELECT dbo.MembTableA.MemberNumber, dbo.MembTableA.StatusCode, dbo.membTableB.Status
FROM dbo.MembTableA LEFT OUTER JOIN
dbo.membTableB ON dbo.MembTableA.MemberNumber = dbo.membTableB.MemberNumber
Where dbo.MembTableA.status IS NULL
AND (dbo.MembTableA.StatusCode) = <cfqueryparam value="555" cfsqltype="cf_sql_varchar">
or dbo.membTableB.Status = <cfqueryparam value="999" cfsqltype="cf_sql_varchar">
Output code on page
<cfinvoke component=.....
method="MemberNumberLst"
returnvariable="MemberNumberLst">
<table>
<tr>
<th>Member Number</th>
<th>Status Code</th>
</tr>
<cfoutput query="MemberNumberLst">
<tr>
<cfif MemberNumberLst.MemberNumber is on both tables ..... >
<td>#MemberNumber# **on both tables**</td>
<cfelse>
<td>#MemberNumber#</td>
</cfif>
<td>#StatusCode#</td>
</tr>
</cfoutput>
</table>
Query in CFC
SELECT dbo.MembTableA.MemberNumber, dbo.MembTableA.StatusCode, dbo.membTableB.Status
FROM dbo.MembTableA LEFT OUTER JOIN
dbo.membTableB ON dbo.MembTableA.MemberNumber = dbo.membTableB.MemberNumber
Where dbo.MembTableA.status IS NULL
AND (dbo.MembTableA.StatusCode) = <cfqueryparam value="555" cfsqltype="cf_sql_varchar">
or dbo.membTableB.Status = <cfqueryparam value="999" cfsqltype="cf_sql_varchar">
Output code on page
<cfinvoke component=.....
method="MemberNumberLst"
returnvariable="MemberNumberLst">
<table>
<tr>
<th>Member Number</th>
<th>Status Code</th>
</tr>
<cfoutput query="MemberNumberLst">
<tr>
<cfif MemberNumberLst.MemberNumber is on both tables ..... >
<td>#MemberNumber# **on both tables**</td>
<cfelse>
<td>#MemberNumber#</td>
</cfif>
<td>#StatusCode#</td>
</tr>
</cfoutput>
</table>