JOIN three tables and aggregate data from multiple rows for every DISTINCT row in separate column
i have a table where one item is mapped with multiple items.
Key 1 | Key 2
1 2
1 5
1 6
1 4
1 8
I have another table like this
Key 1 | ShortKey1Desc
1 'Desc short'
i have one more table where i have data like this
Key 1 | Description
1 'Desc a'
1 'Desc c'
1 'Desc aa'
1 'Desc tt'
i need to write a sql query for my view where table would be generated like this
Key 1 | AllKeys2ForKey1 | AllDescriptionsForKey1 | ShortKey1Desc
1 | 2;5;6;4;8 | Desc a; Desc c; Desc aa; Desc tt | Desc short
Key 1 is a string type field so i need to join them table using that string key
what i'm trying is to create a view for comfortable data access. need to create a query what will not take ages. i already tried to do it with Functions but it takes ages for load.
any help on this one would be highly appreciated. thanks a lot
Assuming that you are unable to change the data structures to make a more efficient query, this will work: