You could do something along the lines of the following (UNTESTED CODE as
always):
<cfset variables.sCurUser = "">
<cfoutput>
<cfloop query="USERS">
<cfif variables.sCurUser is not User>
#User#
<cfelse>
<cfset variables.sCurUser = User>
</cfif>
</cfloop>
</cfoutput>
This solution assumes that you may actually have a use for the duplicate values
in the query at some point. If not, then I would suggest using the DISTINCT
keyword in the query to eliminate the duplicates. If that's not possible, you
could probably stick the query results into a list and perform a REReplaceNoCase
to get rid of the duplicates...
HTH!
--IronFury
On Tue, 16 April 2002, phumes1 wrote
>
>
> Hi,
>
> The below lists all users logged in to the server. If the user has logged
> in more than once then I get multiple usernames listed. How can I only list
> one occurrence of all users?
>
> <cfoutput query="USERS">
> #User#
> </cfoutput>
>
> The above outputs:
>
> Administrator
> Administrator
> Administrator
> Administrator
> test
> test
> user1
> user1
> user2
> user3
> user3
>
> I want to display only:
>
> Administrator
> test
> user1
> user2
> user3
>
>
>
>
>
>
+-----------------------------------------------------------------------------------+
>
> Philip Humeniuk
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
+------------------------------------------------------------------------------------+
>
>
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org