A Query ? Combining 2 Tbls into 1 Column

CharlesWhiteman

Registered User.
Local time
Today, 21:43
Joined
Feb 26, 2007
Messages
421
Hi All, Here is a head scratcher.

In by Db I am designing in some workflow. So I will enable users to create a task. A task can be either for a user or for a group. Users are also part of groups so in other words a task could be created for one person or for a group of people.

My structure is as follows:

TblUsers = TblUsers.UserID, TblUsers.UserName

TblGroups = TblUsersGroups.GroupID, TblUsersGroups.GroupTitle

Then (because many users can beloong to many groups I then have

TblUsersGroupsLink = TblUsersGroupsLink.LinkID, TblUsers.UserID, TblUsersGroups.GroupID

Now heres the question. I want to have a combo box where there is one column shown containing the names of users and the names of groups and I am struggling on how to build that query.

Many thanks in advance of your advice/thoughts. :eek:
 
I am investifgating a Union Query

A union would definitely accomplish what you want. Make sure you rename the columns in the union query so they match on both tables.
 
I've answered my own question. somestimes does the trick explaining it if only to myself!:D But here's the answer for the benefit of the forum.

Code:
SELECT TblUsers.UserID, TblUsers.UserName
FROM TblUsers
UNION SELECT TblUsersGroups.GroupID, TblUsersGroups.Group
FROM TblUsersGroups
 

Users who are viewing this thread

Back
Top Bottom