MySQL Forums
Forum List  »  Newbie

@var as column name
Posted by: _ _
Date: May 29, 2018 02:05AM

Hi all,

I wonder if some solution exist to dynamically set a column name to a Select request.

For exemple:
SET @var = MONTH(NOW());
SELECT SomeColumn as @var, OtherColumn as "Other_Column" FROM ...

And the next step:
SET @var = MONTH(NOW());
SELECT SomeColumn as CONCAT("Result_for_month_",@var) FROM ...

Thank you.

Options: ReplyQuote


Subject
Written By
Posted
@var as column name
_ _
May 29, 2018 02:05AM
May 29, 2018 09:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.