Use alias as an another column. For example, take the below query.
SELECT 'Santosh' as fname, 'Jadi' as lname, fname;
I want to re-use alias fname
as a third column.
Is it possible? If yes, how can i achieve it?
In order to access to fname
, you need to put your query inside a sub-query as below:
SELECT K.fname, K.lname, K.fname as NewFname
FROM(
SELECT 'Santosh' as fname, 'Jadi' as lname
) as K