Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    15

    Unanswered: Q: How to do FULL-JOIN of three tables?

    I need to do FULL-JOIN between three tables, what would the SQL
    statement would be?

    All three tables have one common COLUMN, like

    T1: C1 C2 T2: C1 C3 T3: C1 C4
    a x a y a z
    b x c z

    I want to produce following result set:

    R1: C1 C2 C1_1 C3 C1_2 C4
    a x a y a z
    b x
    c z

    Thanks.

  2. #2
    Join Date
    Apr 2004
    Posts
    15

    Re: Q: How to do FULL-JOIN of three tables?

    BY trial and error, I found solution to the problem I posted. Here is
    the SQL Statement:

    SELECT *
    FROM
    (t1 FULL JOIN t2 ON (t1.c1 = t2.c1))
    FULL JOIN t3 ON (t1.c1 = t3.c1);

  3. #3
    Join Date
    Nov 2011
    Posts
    1

    Re: Q: How to do FULL-JOIN of three tables?

    yeah i was working on a login role module. There i had three tables:

    Users - userid, username
    roles - roleid, rolename
    userinrole - userid, roleid

    I used this query to connect these three tables:

    SELECT u.UserName, r.RoleName FROM aspnet_Users AS u INNER JOIN aspnet_UsersInRoles AS ur ON u.UserId = ur.UserId INNER JOIN aspnet_Roles AS r ON ur.RoleId = r.RoleId

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •