I want to check record exists or not in postgresql and need result in boolean.
NOTE : I know there are simple ways with if else check but what I want is the representation in knex for the query I listed. I also know this is complex but just wants to learn.
I know the query, You can see here below,
select exists(select 1 from test where id = XYZ);
How can I write this postgresql query with knex?
I tried this way but it is not working.
knex.raw(`SELECT exists(${knex(TABLE_NAME).where(CONDITIONS).select('1').toString()})`)