Pages

29 February, 2024

Drizzle ORM select return string that isn't a column

I have a SQL query like this:
SELECT *
FROM (
SELECT 'car' AS type, model FROM car
UNION
SELECT 'truck' AS type, model FROM trucks
) vehicles;



I want to replicate the 'car' as type part in Drizzle so I can distinguish the data being returned without adding a column "type" to both tables and having repetitive data.


Is there a way to do this currently?

No comments:

Post a Comment

Thanks