You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this query in sql: select to_char (created_at,'Mon') as month, extract (year from created_at) as year, id_activity as activity from event group by 1, 2, 3
i tried to understand and make a simple sequelize query out of mysql query shown. I did something like this: model.findAll({ attributes: [[ sequelize.fn('extract(year)', sequelize.col('created_at')), 'data']] });
however, it does not work.
i played around other aggregate function using 'sum', 'min', 'max'.. it does work.
how could i resolve this?..
thank you so much
Please use Github Issue Tracker only for reporting bugs, requesting new features or discussions. Ask questions on Stackoverflow sequelize.js tag or Slack. While I would like to help answer any questions but it still take too much time.
If you are reporting a bug please isolate it as SSCCE, present it nicely and follow issue template. This will help maintainers and contributors understand your issue quickly.
If you are requesting a feature spend some time to properly present your use case with some examples, current and expected outcome.
Issue Description
I have this query in sql:
select to_char (created_at,'Mon') as month, extract (year from created_at) as year, id_activity as activity from event group by 1, 2, 3
i tried to understand and make a simple sequelize query out of mysql query shown. I did something like this:
model.findAll({ attributes: [[ sequelize.fn('extract(year)', sequelize.col('created_at')), 'data']] });
however, it does not work.
i played around other aggregate function using 'sum', 'min', 'max'.. it does work.
how could i resolve this?..
thank you so much
StackOverflow / Slack attempts
https://stackoverflow.com/questions/60849911/how-to-use-select-and-extract-date-into-month-and-year-from-timestamp-in-sequeli
Additional context
Add any other context or screenshots about the issue here.
Issue Template Checklist
Is this issue dialect-specific?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: