Looks like you need that condition in the SELECT list, FROM list and WHERE
clause.
SELECT DISTINCT
yourColumns
<cfif yourCondition>
users.userColumn
</cfif>
FROM yourTable
<cfif yourCondition>
INNER JOIN users ON thisColumn = thatColumn
</cfif>
WHERE someColumn = 'something'
<cfif yourCondition>
AND someUserColumn = 'someUserValue'
</cfif>
Adrian
-----Original Message-----
From: Walter Conti
Sent: 24 March 2008 23:37
To: CF-Newbie
Subject: Help with query ...
select distinct
threads.id,
threads.name,
threads.readonly,
threads.active,
threads.forumidfk,
threads.useridfk,
threads.author,
threads.datecreated,
forums.name as forum,
threads.author as username,
threads.sticky,
threads.views,
conferences.name as conference,
conferences.id as conferenceid,
threads.lastpost,
threads.msgcount as messagecount
from
(threads inner join forums on threads.forumidfk = forums.id)
inner join conferences on forums.conferenceidfk = conferences.id
where 1=1
<cfif arguments.bActiveOnly>
and threads.active = 1
</cfif>
<cfif isDefined("arguments.forumid")>
and threads.forumidfk = <cfqueryparam value="#arguments.forumid#"
cfsqltype="CF_SQL_VARCHAR" maxlength="35">
</cfif>
======================================
..... as it is now it works fine but I need to add the following condition :
<cfif isDefined("arguments.testOnly") and arguments.testOnly IS 1>
and users.testOnly = <cfqueryparam value="#arguments.testOnly#"
cfsqltype="CF_SQL_SMALLINT">
</cfif>
please help with the [select] and [from] (inner join?). Thank you very much.
=====================================
order by threads.sticky desc, threads.lastpost desc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3492
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15