Yes, because the normal column is named likes so I just put two s for the other one.
– Aug 14 '17 at 18:47
Also when I do console.log(posts[0].likess); in nodejs its returning undefined for some reason. I think its an alias problem in sequelize. I cannot access alias for some reason. When I use alias "likess".
[models.sequelize.fn('sum', models.sequelize.col('likes')), 'likess']]
– Aug 14 '17 at 18:52
Please don't make more work for other people by vandalizing your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](//creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed. Thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](//meta.stackexchange.com/q/5221)
– MachavityDec 18 '19 at 15:43
1 Answers1
3
Did this and worked.
posts[0].get('aliasName')
Thanks for pointing this out! Added some documentation mentions of this at: https://stackoverflow.com/questions/32649218/how-do-i-select-a-column-using-an-alias/69890944#69890944 now.
– Ciro Santilli OurBigBook.comNov 08 '21 at 23:08