Looks like its doing a record for each distinct date in the message table,
when presumably you only wnat the latest. BTW you don't need the codes in
the joins as display fields. You would be better using group for this kind
of thing. 
Something like this should work:

SELECT t.bbsThreadTitle,
t.bbsIsClosed, c.bbsCatTitle, Max(m.bbsMessageDate)
FROM    tbl_BBS_Messages AS m, tbl_BBS_Threads AS t, tbl_BBS_Categories AS c
GROUP BY
t.bbsThreadTitle,
t.bbsIsClosed, c.bbsCatTitle
WHERE                           DateDiff(d,m.bbsMessageDate, #local.today#)
< 1
AND                                     t.bbsThreadID = m.bbsThread
AND                                     t.bbsCategory = c.bbsCatID
ORDER BY                        Max(m.bbsMessageDate), c.bbsCatTitle




-----Original Message-----
From: Chris Martin [mailto:[EMAIL PROTECTED]]
Sent: 23 March 2001 20:17
To: CF-Talk
Subject: Select distinct not working


I was wondering if anyone can see anything wrong with this query:

SELECT Distinct         m.bbsThread, t.bbsThreadTitle, m.bbsMessageDate,
t.bbsCategory, t.bbsIsClosed, c.bbsCatID, c.bbsCatTitle
FROM                            tbl_BBS_Messages AS m, tbl_BBS_Threads AS t,
tbl_BBS_Categories AS c
WHERE                           DateDiff(d,m.bbsMessageDate, #local.today#)
< 1
AND                                     t.bbsThreadID = m.bbsThread
AND                                     t.bbsCategory = c.bbsCatID
ORDER BY                        m.bbsMessageDate, c.bbsCatTitle

I run it, and it will return two results for the same thread, even though I
have select distinct in there.  Any one know why?

Thanks,

Chris Martin

-----Original Message-----
From: Jon Hall [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 9:41 PM
To: CF-Talk
Subject: Re: Textbox validation


One of the Figleaf guys posted a much nicer version of this using regex a
month or so back, so you may want to check the archives.
Here is what I use to keep people from typing characters in text fields
though.

This goes in head

<SCRIPT TYPE="text/javascript">
<!--
function letternumber(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) ||
    (key==9) || (key==13) || (key==27) )
   return true;

// alphas and numbers
else if ((("abcdefghijklmnopqrstuvwxyz0123456789 ").indexOf(keychar) > -1))
   return true;
else
   return false;
}
//-->
</SCRIPT>

Call it with this in you input tag.
 onKeyPress="return letternumber(event)"

Just change the characters to whatever you want. It will work for spaces
also.
Of course though, you should never rely on javascript...

jon
----- Original Message -----
From: "W Luke" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, March 22, 2001 7:39 PM
Subject: Textbox validation


> Hi,
>
> On one textbox I need to prohibit users entering more than one word - I
> don't want them to enter a space.  What's the best way of doing this -
> Javascript, or Cold Fusion after the form has been posted?
>
> Thanks.
>
> Will
> --
> [EMAIL PROTECTED] -=- www.lukrative.com
> Local-Advertising -=- www.localbounty.com
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to