SQL Query - Fetching original channel title for OrderItem

Hi,


I need some help with getting the original channel title for order items in Linnworks. It seems the Linnworks stores all the original channel titles in a table called item_channel_title which uses 2 fields for id and the title.


I am trying to reference the original title from each order item, however, many of the fkChannelTitleId fields do not contain a value which I assume is the id reference as I cannot find anything else in the schema.


SELECT

oi.fkChannelTitleId AS 'Original ID' 

FROM   

[OrderItem] AS oi


Does anyone know another way to get the original title for the OrderItem as I see it is possible in the Linnworks processed orders export?


Thanks

Ronan

Hello Ronan, 


Thank you for your question.


The issue here is that you can retrieve titles using your way for all channels apart from eBay because eBay channel titles are not stored in the same database table I am afraid.


But you can retrieve channel titles for OrderItem separately for eBay and all the rest channels.


Here is how you can do it for eBay:


SELECT 

oi.fkOrderId,

fkStockId,

itemSource,

ChannelSKU,

si.cItemName

FROM [dbo].[OrderItem] oi

LEFT JOIN StockItems si

ON oi.fkStockid = si.pkStockId

WHERE oi.fkOrderId IN (

SELECT pkOrderID

FROM

[dbo].[Order] WHERE

Source = 'EBAY')


Hope it helps!


Have a nice day.


Kind regards,

Julietta


Technical Support


Login to post a comment