yeah, as you are using a MAX() you are going to need a group by...
try...
group by d.docTitle, d.docIntro, d.docContent, d.docImage, d.ID

On 5/8/06, Seona Bellamy <[EMAIL PROTECTED]> wrote:
On 08/05/06, Lucas <[EMAIL PROTECTED] > wrote:
Ok, that is what is playing up for you - ask you can have more than one category per article, dc.categoryID will make two records that appear the same to be different (two different categoryIDs)

you may want to wrap it in a Max() so you only get one categoryID.

L.

Ah, good call. I hadn't considered that aspect of it.

I tried changing the query to this:

    SELECT        DISTINCT(d.docTitle), d.docIntro, d.docContent, d.docImage, MAX(dc.categoryID), d.ID

    FROM           r_document AS d,r_docByType AS dt,r_docByCategory AS dc
    WHERE        dt.docTypeID = 1
    AND             dt.documentID = d.ID
    AND             dc.documentID = d.ID
    ORDER BY  d.dateEntered DESC
    LIMIT           3

The error it gave me said something about a problem with the GROUP BY clause - which is strange, because there isn't one. Does there need to be? I've looked in the online manual, and I can't see anything that suggests Max() can only be used with a GROUP BY.

Cheers,

Seona.







--

Lucas

http://www.thebitbucket.net
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to