Column name alias
Is there a way to create column name alias in SELECT queries ? like (name as petName).
3 Replies
Is my first time answering here so don't fully trust me. I was able to rename a select column with the sql as() function. For example:
But when doing that the type of username isn't inferred, so you can add the type you want using <>.
^ This
@aitorcas oy cool buddy thanks for the reply, I was hoping there is something built-in, like we have on select({ user: true }) maybe select({ user: 'username' }), you know what I mean
but this is also fine for me, as I'm quite a fan of query builders (see you kysely)