is it possible to write any logic like this using OR ?

SELECT p.* FROM products p JOIN categories c ON p.category_id = c.category_id WHERE c.full_path LIKE 'Electronics/Laptop/%' OR c.full_path = 'Electronics/Laptop'; is it possible to write any logic like this using OR ?
13 Replies
francis
francis10mo ago
i'm confused, this should do exactly what you want what is your question
Alvee
AlveeOP10mo ago
not row but dirzzle orm stuff
francis
francis10mo ago
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Alvee
AlveeOP10mo ago
umm not sure what's wrong. it works when I put withotu variable the pathname
No description
No description
Alvee
AlveeOP10mo ago
this one works without the pathurl in a variable
No description
Alvee
AlveeOP10mo ago
how can I put the Electronic/Laptop dy namicly from variable @francis
francis
francis10mo ago
why are you not using the actual query builder api
Alvee
AlveeOP10mo ago
it shows raw SQL don't have any option to use OR without raw SQL
francis
francis10mo ago
????????? read the link I said .where(or(condition1, condition2)) ?????
Alvee
AlveeOP10mo ago
saw there arleady
No description
Alvee
AlveeOP10mo ago
umm fak I missed
francis
francis10mo ago
dude that is illustrating what the generated sql is
Alvee
AlveeOP10mo ago
yea my bad @francis thanks bro. I thought not possbile cuz the ai on drizzle orm was saying rip.
Want results from more Discord servers?
Add your server