On the use of COUNT function by knex

I have implemented a SQL statement that contains a COUNT function. Now I want to convert it into a KNEX statement. How can I implement it?

SELECT count("uAns") FROM test,questions WHERE test.userId ="1" AND test.queId=questions.id AND test.uAns=questions.answer

New beginners, and please give us a lot of advice. Thank you in advance.

Apr.05,2022

.count('uAns as a')
.join('questions', function() {
    this.on('questions.id', '=', 'test.queId').andOn('questions.answer', '=', 'test.uAns')
    })
.where('test.userId',userId)

after referring to the official documents, I gathered one by myself, but it was very empty. I felt that there must be something wrong. Although I got the expected data, I still looked forward to the guidance of my predecessors

.
Menu