Naveed Sheriffdeen
Naveed Sheriffdeen

Reputation: 980

how to change sequelize inner join output format

I have a problem in Sequelize. I have a query than gets data through an inner join and the response data comes in the following format;

`item.Item_name`

how do i change the output to

`Item_name`

when using raw sql we use as to provide an alias to the query outputs. my question is how do i do that within sequelize. or is there any other method to fix this. or can anyone let me know the method to read the above data format within react-native.Thanks

Upvotes: 0

Views: 236

Answers (1)

Vivek Doshi
Vivek Doshi

Reputation: 58593

For that , You need to define attributes at the top level of include :

attributes : [['item.Item_name','Item_name']]

And I think , you are using raw:true in your query , that is why you are getting name like that , remove that and you will get proper nested values.

Upvotes: 1

Related Questions