select * from
(
select
field_feedback_action_id,
count(1) as field_feedback_action_count
from t_field_feedback
group by field_feedback_action_id
) t
where t.field_feedback_action_count > 1
order by t.field_feedback_action_count desc
limit 4
i try to create this sql like below
let subQuery = table
.subQuery('t')
.select(
table.field_feedback_action_id,
table.field_feedback_action_id.count().as("field_feedback_action_count")
)
.group(table.field_feedback_action_id);
let query = table.
from(subQuery)
.where(subQuery.field_feedback_action_count.gt(1))
.order(subQuery.field_feedback_action_count.descending)
.limit(4)
bu it is converted to
SELECT * FROM (
SELECT
"t_field_feedback"."field_feedback_action_id",
COUNT("t_field_feedback"."field_feedback_action_id") AS "field_feedback_action_count"
FROM "t_field_feedback"
GROUP BY "t_field_feedback"."field_feedback_action_id"
) "t"
WHERE ("t"."field_feedback_action_count" > 1)
ORDER BY "t_field_feedback"."field_feedback_action_id"
DESC LIMIT 4
subQuery.field_feedback_action_count.gt(1).toString()
is converted to
"t"."field_feedback_action_count" > 1
but
subQuery.field_feedback_action_count.descending
is converted to
COUNT("t_field_feedback"."field_feedback_action_id") DESC
I have a query in postgresql like below
i try to create this sql like below
bu it is converted to
subQuery.field_feedback_action_count.gt(1).toString()
is converted to"t"."field_feedback_action_count" > 1
but
subQuery.field_feedback_action_count.descending
is converted toCOUNT("t_field_feedback"."field_feedback_action_id") DESC