I have 3 tables, user, role and userrole. Userrole stores user_id and role_id, so every user is associated with some role(s).
So, when i use this query to view all users, and if user has several roles, i can see several rows with identical info and just role column is different.
select userrole.USERNAME , FIRSTNAME , LASTNAME , LOCKED , EMAILADDRESS , ROLENAME from user, role, userrole where userrole.USERNAME = user.USERNAME and userrole.ROLEID = role.ROLEID result: coguserba cogba cogba 0 firstname.lastname@example.org 2 coguserba cogba cogba 0 email@example.com 5
I tried to use JOIN, but found that it won't help me in this case. Unfortunately i'm not an expert in SQL, so can you please tell me if there is some way to combine such fileds to look like this without extensive shell scripting:
coguserba cogba cogba 0 firstname.lastname@example.org 2;5
The final goal would be to export this info into csv file (already done with sqlplus), with no nearly identical strings.