Skip to content
Advertisement

how do i name a similar column from sql with different column names in a select statement

There is a column 'client_code' in sql table 'tb_accounts'. I want to create a select statement with two column aliases 'cl_code' and 'acc_num', but all populated from the 'client_code' column.

Advertisement

Answer

Select results are aliased like:

SELECT
acc.client_code as acc_num,
acc.client_code as cl_code
FROM
tb_accounts as acc
WHERE ....
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement