Hi!

>>>>> "Fournier" == Fournier Jocelyn <[Presence-PC]" <[EMAIL PROTECTED]>> writes:

Fournier> Hi,
Fournier> So I assume in this case the only way to have distinct results is to use
Fournier> "GROUP BY topic" clause ?

If you do this, you can't still use 'ORDER BY date' as 'date' is not
part of the GROUP BY columns.

<cut>

>> > mysql> SELECT DISTINCT topic FROM
>> > forum.searchmainpresencepc4,forum.searchjoinpresencepc4 WHERE
>> > searchmainpresencepc4.numreponse=searchjoinpresencepc4.numreponse AND
>> > (mot='les') ORDER BY date DESC LIMIT 0,40;

The main problem is what you try to do is not legal in SQL.

What you probably want to do is the following:

SELECT DISTINCT topic,max(date) as d FROM
forum.searchmainpresencepc4,forum.searchjoinpresencepc4 WHERE
searchmainpresencepc4.numreponse=searchjoinpresencepc4.numreponse AND
(mot='les') group by topic ORDER BY d DESC LIMIT 0,40;

And just ignore the d column from the result

Regards,
Monty

-- 
For technical support contracts, goto https://order.mysql.com/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Michael Widenius <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, CTO
/_/  /_/\_, /___/\___\_\___/   Helsinki, Finland
       <___/   www.mysql.com


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to