Ok, so i needed to write this query for a procedure im working on and not many people know how to connect the pet inventory table to the character table.... so this query will explain how its done...
im not going to explain every single detail, like how there is no charcos when pet is despawned / dead... but yea you can probably figure that all out from this query...
The code...
Code:
USE [SRO_VT_SHARD]
SELECT pet_invo.[ItemID]
,pet_invo.[Slot] PetSlot
,pet_item.[ID64] PetID64
,pet_item.[RefItemID]
,pet_common.[CodeName128]
,pet.[ID] PetID
,pet.[CharName] PetName
,pet.[RentEndTime]
,char_invo.[Slot] CharSlot
,char_item.[ID64] CharID64
,char_item.[RefItemID]
,char_common.[CodeName128]
,chr.[CharID]
,chr.[CharName16]
FROM [dbo].[_InvCOS] AS pet_invo
JOIN [dbo].[_Items] pet_item ON pet_item.[ID64] = pet_invo.[ItemID]
JOIN [dbo].[_RefObjCommon] pet_common ON pet_common.[ID] = pet_item.[RefItemID]
JOIN [dbo].[_CharCOS] AS pet ON pet.[ID] = pet_invo.[COSID]
JOIN [dbo].[_Items] AS char_item ON char_item.[Data] = pet.[ID] AND char_item.RefItemID IN (SELECT [ID] FROM [SRO_VT_SHARD1].[dbo].[_RefObjCommon] WHERE [Service] = 1 AND [TypeID1] = 3 AND [TypeID2] = 2 AND [TypeID3] = 1 AND [TypeID4] = 2)
JOIN [dbo].[_RefObjCommon] char_common ON char_common.[ID] = char_item.[RefItemID]
JOIN [dbo].[_Inventory] AS char_invo ON char_invo.[ItemID] = char_item.[ID64]
JOIN [dbo].[_Char] AS chr on chr.[CharID] = char_invo.[CharID]
WHERE pet_invo.[ItemID] > 0