OrderBy with dynamic queries dont work

....orderBy(sql`${products.xyz} ${order}`)
....orderBy(sql`${products.xyz} ${order}`)
error: syntax error at or near "$2"
error: syntax error at or near "$2"
order is 'asc' / 'desc'
1 Reply
AlcaponeYou
AlcaponeYou2y ago
Andrew already answered, but in case anyone else has similar issues: Any sql template value that you don't want quotes, ie sql keywords, should be wrapped in sql.raw
Want results from more Discord servers?
Add your server