Search
Get Started
DT
Drizzle Team
•
3y ago
eatmoose
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
'
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,793
Members
View on Discord
Was this page helpful?
Yes
No
A
AlcaponeYou
•
6/1/23, 6:16 PM
Andrew already answered
, but in case anyone else has similar issues
:
Any
template value that you don
't want quotes
, ie sql keywords
, should be wrapped in
sql
sql
sql.raw
sql.raw