OK, I have two tables:
table1:
id, group1, group2
-------------------
1, 1, 3
2, 1, 2
3, 2, 3
4, 1, 3
table2:
id, groupname
-------------
1, user_group
2, old_group
3, new_group
In table1, group1 and group2 correspond to id in table2.
I want to select * from table 1, but join the names from table2 so the
results, would look like:
1, user_group, new_group
2, user_group, old_group
3, old_group, new_group
4, user_group, new_group
Now, I know how to join one column to one column, but how do you join 2
columns to one column (i.e. join both table1.group1 and table1.group2 to
table2.groupnam e) in one statement?
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ sugapablo@12jab ber.com <--jabber IM ]
table1:
id, group1, group2
-------------------
1, 1, 3
2, 1, 2
3, 2, 3
4, 1, 3
table2:
id, groupname
-------------
1, user_group
2, old_group
3, new_group
In table1, group1 and group2 correspond to id in table2.
I want to select * from table 1, but join the names from table2 so the
results, would look like:
1, user_group, new_group
2, user_group, old_group
3, old_group, new_group
4, user_group, new_group
Now, I know how to join one column to one column, but how do you join 2
columns to one column (i.e. join both table1.group1 and table1.group2 to
table2.groupnam e) in one statement?
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ sugapablo@12jab ber.com <--jabber IM ]
Comment