Question

I want to display all related information in to the same row column. Currently my output and query are the following:

Trader Items
Prapor Weapons
Prapor Wearables
Prapor Weapon Modifications
Prapor Health and Buffs
Therapist Weapons
Therapist Wearables
Therapist Weapon Modifications
Therapist Health and Buffs
select NPC_Traders.Nickname as Trader, Classes.Class as Items
from NPC_Traders, Classes
where Items IN (
           select npc.Tradeables
           from NPC_Traders npc 
           where npc.Tradeables LIKE '%1%' OR
                 npc.Tradeables LIKE '%2%' OR
                 npc.Tradeables LIKE '%3%' OR
                                npc.Tradeables LIKE '%4%');

I want to display the information such as:

Trader Items
Prapor Weapons, Wearables, Weapon Modifications, Health and Buffs
Therapist Weapons, Wearables, Weapon Modifications, Health and Buffs

Is there a technique I can use to solve this issue?

No correct solution

OTHER TIPS

You can apply the GROUP_CONCAT function on top of your existing query like so:

SELECT Trader, GROUP_CONCAT(Items, ',') AS Items
FROM 
(
    select NPC_Traders.Nickname as Trader, Classes.Class as Items
    from NPC_Traders, Classes
    where Items IN (
               select npc.Tradeables
               from NPC_Traders npc 
               where npc.Tradeables LIKE '%1%' OR
                     npc.Tradeables LIKE '%2%' OR
                     npc.Tradeables LIKE '%3%' OR
                                    npc.Tradeables LIKE '%4%')
) AS Subquery
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top