New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sequelize.fn(Sequelize.col(...)) IN (...)
in where condition?
#2077
Comments
This is an ideal case for |
@mickhansen Thanks.
in |
@mickhansen
But am unable to get it to work. Am I missing something, or is there a workaround using sequelize.literal that will accomplish the same thing. Interestingly the query executes but doesn't perform any filtering at all. |
return Company.findAll({
where: Sequelize.where(
Sequelize.fn("UPPER", Sequelize.col("CompanyName")),
{ like: 'B%' }
)
}); Works fine for me on latest master SELECT `id`, `CompanyName` FROM `companies` AS `company` WHERE UPPER(`CompanyName`) LIKE 'B%'; |
Thanks, is there any to get this version from npm or do I need to clone the latest git and link it locally. The 2.0.0 rc version i just got from npm does not work. |
npm install sequelize/sequelize |
@djmadcat Finally fixed :) - See the test in the referenced commit for the required syntax |
As a note, to combine where: [
sequelize.where(
sequelize.fn('array_length', sequelize.col('patterns'), 1),
{ [Op.gt]: 0 },
),
{ companyId: this.companyId },
], |
Can't find is it possible to add something like
COALESCE(place_type_codename, announcement_type_codename) IN ('Lost', 'Found')
to
where
condition?i.e.:
I know we can do something like
but let's assume that we have another complex function.
Thanks.
The text was updated successfully, but these errors were encountered: