I'm building a database to administer groups of users. To make the
administration easier there's a table containing cascading couplings of
user groups so that if I create a user in the group 'math students' that
user is also included in the groups 'students' and 'users'. For this
purpose, I've created a table with just two columns:
+---------+--------+
| grouplinks |
+---------+--------+
| fromgid | togid |
+---------+--------+
| 156 | 110 |
| 157 | 110 |
| 111 | 110 |
| 110 | 100 |
| ... | ... |
+---------+--------+
I also have a table with information about the groups:
+-----+---------+------------------+
| Groups |
+-----+---------+------------------+
| gid | gname | label |
+-----+---------+------------------+
| 100 | users | Users |
| 110 | students| Students |
| 111 | teachers| Teachers |
| 156 | maths | Math students |
| 157 | physs | Physics students |
| ... | ... | ... |
+-----+---------+------------------+
My problem is this: How can i create an MySQL-query to retrieve a
listing of grouplinks with the names of the groups? To create a listing
of either column, I'd use something like 'SELECT gname FROM
grouplinks,Groups WHERE fromid=gid', but how do I get this listing
containing _both_ the columns in grouplinks?
Regards
/Ed
--
###### ====== ------ Eddie Olsson ------======######
###### A computer without MS Windows is like a fish without a bicycle ######
-----------------------------------------------------------
Send a mail to [EMAIL PROTECTED] with
unsubscribe mysql [EMAIL PROTECTED]
in the body of the message to unsubscribe from this list.