Answered
Problem with a Join Query
Struggling to get my head around this, so would appreciate
any help.
I'm running the query below, which includes a join. If I run this query through Navicat (a MySQL GUI, for those that aren't familar) - I get the expected result.
I also have a fairly similar query running on the site elsewhere successfully, so I'm struggling to figure out why it's not working.
The query is;
<cfquery name="getwatched" datasource="#datasource#">
SELECT r.retailer_name, r.id, r.shortname, d.id, d.merchant_id, d.user_id, d.e_updates
FROM cc_watchlists d
LEFT JOIN merchants r
ON d.merchant_id=r.id
WHERE d.user_id=#SESSION.Auth.ID#
ORDER BY r.retailer_name ASC
</cfquery>
and the output;
<cfoutput query="getwatched">
<dt><a href="page.cfm?for=#shortname#">#retailer_name#</a></dt>
</cfoutput>
The error states;
coldfusion.runtime.UndefinedVariableException: Variable SHORTNAME is undefined.
I'd be grateful of any help!
I'm running the query below, which includes a join. If I run this query through Navicat (a MySQL GUI, for those that aren't familar) - I get the expected result.
I also have a fairly similar query running on the site elsewhere successfully, so I'm struggling to figure out why it's not working.
The query is;
<cfquery name="getwatched" datasource="#datasource#">
SELECT r.retailer_name, r.id, r.shortname, d.id, d.merchant_id, d.user_id, d.e_updates
FROM cc_watchlists d
LEFT JOIN merchants r
ON d.merchant_id=r.id
WHERE d.user_id=#SESSION.Auth.ID#
ORDER BY r.retailer_name ASC
</cfquery>
and the output;
<cfoutput query="getwatched">
<dt><a href="page.cfm?for=#shortname#">#retailer_name#</a></dt>
</cfoutput>
The error states;
coldfusion.runtime.UndefinedVariableException: Variable SHORTNAME is undefined.
I'd be grateful of any help!
