Open Gerodork opened 7 years ago
Bump!
I have a similar case, where I want to use an in
statement with an AND
operator, instead of OR
. This seems to be the only way to accomplish what I want.
let getCategoryCount = category_initiatives.categoryId
.count()
.distinct();
getCategoryCount.alias = null;
selectedInitiatives = selectedInitiatives
.where( category_initiatives.categoryId.in( chosenCategories ) )
.group( category_initiatives.initiativeId )
.having( getCategoryCount.equals( chosenCategories.length ) );
The offending function is in the last line of the code. Above this snippet is the actual SELECT
statement, etc.
I'm trying to get some specific data from my database. I found what request I needed in SQL, but it involves a count of a case. I tried just adding ".count()" at the end of my case but it says that it isn't a function. Here's the request in SQL
And here's the supposed javascript
Anyone has an idea if it's already implemented? Or did I do something wrong? Thanks for any help !