SELECT pmi.thread_id, pm.subject, MAX(pm.timestamp) as timestamp, MAX(pmi.new) as new FROM pm_message pm INNER JOIN pm_index pmi ON pm.mid = pmi.mid WHERE (pmi.uid = 1) AND (pmi.deleted = 0) GROUP BY pmi.thread_id ORDER BY pmi.new desc, MAX(pmi.mid) DESC
Does not work on my installation of Drupal 6.4 with mysql 4.1.22. If I removing the max from the order by is working. Or if I change it to use the one of the groups selected in the select.
Am I missing something here?
Comments
Comment #1
naheemsays commentedwhat does replacing "MAX(pmi.mid)" with "timestamp" do for you?
Comment #2
kellyburton commentedI actually just removed it from the order by, since the items are already sorted.
Comment #3
naheemsays commentedCan you please still add it and try?
Without it, the items are still sorted, but just with the threads with new replies at the top. there is no sorting after that to get the messages in the right order.
Comment #4
illepic commentedI replaced "MAX(pmi.mid)" with "timestamp" and the error went away. No messages to test sorting on yet, however.
Comment #5
naheemsays commentedThanks, I will change it to timestamp.
Fixing in #315325: Userblocking architecture + other fixes.
Comment #6
kellyburton commentedThis is rebroken in the lastest release.
Comment #7
berdir- latest release ? do you mean dev or rc2 ? I can't reproduce it in any version I have.
Can you please post the exact error message ?
Comment #8
kellyburton commentedMy mistake, I just tried both the RC2 and the DEV version and I am not getting the error now.