Simply wrap your reused alias with (SELECT alias)
:
SELECT 10 AS my_num,
(SELECT my_num) * 5 AS another_number
FROM table
More Related Contents:
- ‘IF’ in ‘SELECT’ statement – choose output value based on column values
- 1052: Column ‘id’ in field list is ambiguous
- How to do a batch insert in MySQL
- Count the occurrences of DISTINCT values
- What’s faster, SELECT DISTINCT or GROUP BY in MySQL?
- MySQL Trigger after update only if row has changed
- difference between primary key and unique key
- Error creating table: You have an error in your SQL syntax near ‘order( order_id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_id ‘ at line 1 [duplicate]
- MySQL Query to select data from last week?
- How do I add a custom CHECK constraint on a MySQL table?
- Cast int to varchar
- Import SQL file into mysql
- How to change the default port of mysql from 3306 to 3360
- How to skip certain database tables with mysqldump?
- “where 1=1” statement [duplicate]
- How to set a MySQL row to READ-ONLY?
- Laravel join with 3 Tables
- MySQL: LAST_INSERT_ID() returns 0
- Difference between two table structure
- Calculating a Moving Average MySQL?
- Alternative to using LIMIT keyword in a SubQuery in MYSQL
- How to insert a file in MySQL database?
- Strings as Primary Keys in MYSQL Database [closed]
- MySQL : ERROR 1215 (HY000): Cannot add foreign key constraint
- MySQL equivalent of Oracle’s SEQUENCE.NEXTVAL
- How to speed up sql queries ? Indexes?
- Selecting distinct 2 columns combination in mysql
- How to store a one to many relation in MySQL database?
- MySQL – Complexity of: SELECT COUNT(*) FROM MyTable;
- MySQL: Computed Column