SQL Query Needed: Get all owners of existing items & add to Group Identity.

Hello all,

Need single SQL query that will get all owners(set using owned_by_id property) of existing items of particular Item Type & add all of them to the Group Identity as members.

Query should except null & repetitive owners.

Thanks.

  • Hi GS,

    your question is impossible to answer, as you don´t provide much information about what you want to do at all.

    What you want to achieve seems like a mix of a "get" and "add" request. Do you really want to solve this one with pure SQL? While you can get the information with SQL, you should never use SQL to "add" something.

    For the SQL "get" part, simple use an SQL view so you have an easy frontend that helps you to get the correct SQL query. Than you can apply a "group by" filter so you can get all the owners. You can link your ItemType table to the "Identity" table, this way you get the names of your identities.

    For this kind of questions it´s always helpful if you try provide a sample of what you have done so far. This makes it a lot easier for other users to understand your request!

  • This might be on the wrong reddit as im using AWS Redshift, but I figured the syntax and issue is similar.

    When doing group by's, why do we have to group by all the columns we select?

    example:

    select name, date, age

    from persons

    group by name, date, age

    Why is it not possible to just group by one column?