Newbie here.
>From Sequel docs
<http://sequel.jeremyevans.net/rdoc/files/doc/sql_rdoc.html>, we have
Identifier aliases
You can also alias identifiers by using the triple undersecore special
notation
:column___alias or :table__column___alias:
items.literal(:price___p)
# price AS p
items.literal(:items__price___p)
# items.price AS p
Another way to alias columns is to use the Sequel.as method:
items.literal(Sequel.as(:price, :p))
# price AS p
You can use the Sequel.as method to alias arbitrary expressions, not just
identifiers:
items.literal(Sequel.as(DB[:posts].select{max(id)}, :p))
# (SELECT max(id) FROM posts) AS p
I hope it helps you.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.