Natan Parmigiano
Explore posts from serversDTDrizzle Team
•Created by Natan Parmigiano on 10/16/2024 in #help
[Solved] Aliasing a column
Is there any way to alias a column on a select?
I mean an actual alias on the final query..
In starting to test out the new views support (amazing btw), I noticed a "problem"..
Normally if we have colliding colum names, like for instance: users.name and posts.name, we would alias them as user_name and post_name, for example, but currently drizzle queries them as "users"."name" and "posts"."name" In the view, which, at least in SQLite, creates a view with two "name" columns (returned as name and name:1)
That creates issues when filtering and joining data..
Maybe supporting the .as() function on columns for selects in general could be useful? Instead of only supporting it on sql``?
5 replies