[EMAIL PROTECTED] wrote:
> Reported By:                ekristen
> adding the user_idnr to the dbmail_messages table would improve selecting
> messages from the database for someone who would be writing a webmail
> interface for dbmail. So upon message injection into the database just add
> the user_idnr to the dbmail_messages as well, because you already have the
> mailbox_idnr and the physmessage_id in there if you just add the user_idnr
> it would make querying the database 100% easier.

There is such a thing as JOIN in sql that will do in sql what you want to do in
the schema:

to get all messages for a user

select * from dbmail_messages
 left join dbmail_mailboxes ON
   dbmail_messages.mailbox_idnr=dbmail_mailboxes.mailbox_idnr
 left join dbmail_users ON
   dbmail_mailboxes.owner_idnr = dbmail_users.user_idnr
where dbmail_users.userid="<someuserid>";



-- 
  ________________________________________________________________
  Paul Stevens                                  mailto:[EMAIL PROTECTED]
  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
  The Netherlands________________________________http://www.nfg.nl

Reply via email to