S
samearle
Help me write this for MS access, I'm used to Oracle, and I'm really
bad at coding SQL! -
SELECT Users.*, group_1, group_2, group_3
from
(select UserInGroup.UserID,
max(decode(UserInGroup.GroupID, 1, UserInGroup.GroupID, null))
as group_1,
max(decode(UserInGroup.GroupID, 2, UserInGroup.GroupID, null))
as group_2,
max(decode(UserInGroup.GroupID, 2, UserInGroup.GroupID, null))
as group_3
from Users u, UserInGroup g
where u.UserID = g.UserID
and u.GroupID in (1,2,3)
group by u.UserID
)
bad at coding SQL! -
SELECT Users.*, group_1, group_2, group_3
from
(select UserInGroup.UserID,
max(decode(UserInGroup.GroupID, 1, UserInGroup.GroupID, null))
as group_1,
max(decode(UserInGroup.GroupID, 2, UserInGroup.GroupID, null))
as group_2,
max(decode(UserInGroup.GroupID, 2, UserInGroup.GroupID, null))
as group_3
from Users u, UserInGroup g
where u.UserID = g.UserID
and u.GroupID in (1,2,3)
group by u.UserID
)