Kris zoob-at-doomstar.com |Lists| wrote:
I am trying to join to tables:

users:
uid   name
1      john
2      jim
3      mary

groups:
groupid   groupname   groupowner   groupcreator
  1         test1               1                     1
   2        test2               1                     2
   3         test3            2                  3

My desired output would look like:

groupid   groupname   owner      creator
   1         test1            john         john
   2         test2            john         jim
   3         test3            jim           mary

I was unable to find an example online.. Can anyone help?

try something like :
select groupid, groupname, owner.name as f_owner, creator.name as f_creator from groups, users as owner, users as creator where groups.groupowner = owner.uid and groups.groupcreator = creator.uid;


(untested - but principle should be sound...)

Peter
--
Peter Valdemar Mørch
http://www.morch.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to