Just curious, but I'm wondering why you're joining to the messageblks table as it doesn't appear to have any bearing on the query?
Why not: SELECT DISTINCT physmessage.id, physmessage.messagesize, messages.seen_flag, physmessage.internal_date FROM dbmail_mailboxes mailboxes, dbmail_messages messages, dbmail_physmessage physmessage WHERE mailboxes.owner_idnr='4' AND messages.status<'2' AND mailboxes.mailbox_idnr=messages.mailbox_idnr AND messages.physmessage_id=physmessage.id ORDER BY physmessage.id DESC Not being familiar with the 2.0 schema yet, this might be a dumb comment, but as it's just a normal join, I don't think you're trying to verify that physmessage has a mate in messageblks. -Micah > SELECT DISTINCT physmessage.id, physmessage.messagesize, > messages.seen_flag, physmessage.internal_date > > FROM dbmail_mailboxes mailboxes, dbmail_messages messages, > dbmail_physmessage physmessage, dbmail_messageblks messageblks > > WHERE mailboxes.owner_idnr='4' AND messages.status<'2' > > AND mailboxes.mailbox_idnr=messages.mailbox_idnr AND > messages.physmessage_id=physmessage.id AND > messages.physmessage_id=messageblks.physmessage_id > > ORDER BY physmessage.id DESC > --- > > Is this the best way to extract the wanted values, or are > there any shortcuts that can be made? > > I really wish we had preparsed headers now.. > > -=Dead2=- > > _______________________________________________ > Dbmail-dev mailing list > Dbmail-dev@dbmail.org > http://twister.fastxs.net/mailman/listinfo/dbmail-dev >