Hi all,

I could use some help here...

My next target will be server-side threading. All the basics are in
place, but now I need to figure out some smart queries to get this going.

I'v got this so far:

get the basic ORDEREDSUBJECT threads for a mailbox:

select
  message_idnr, datefield, subjectfield
from dbmail_messages
 join dbmail_subjectfield using (physmessage_id)
 join dbmail_datefield using (physmessage_id)
where mailbox_idnr=17
order by subjectfield, datefield;

get the start of each thread (the same, but with an added group-by clause):

select
  message_idnr, datefield, subjectfield
from dbmail_messages
  join dbmail_subjectfield using (physmessage_id)
  join dbmail_datefield using (physmessage_id)
where mailbox_idnr=17
group by subjectfield
order by subjectfield, datefield;

Now, the datefield and subjectfield in the select clause are for
debugging purposes only of course. I would like to see if I can combine
these into a single query.

The basic problem is that using these, the base-subjects are not ordered
by sent-date (datefield). And using a primary sort by datefield won't
let me group by subjectfield like I want to....

Any ideas anyone?



-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl

Reply via email to