mysqlsql

How to select the same column twice with different names?


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.


Solution

  • Select results are aliased like:

    SELECT
    acc.client_code as acc_num,
    acc.client_code as cl_code
    FROM
    tb_accounts as acc
    WHERE ....