Reputation: 5
I have the following query in mysql, and was wondering how I could insert multiple aliases at the same time, any help would be great!
mysql>
SELECT emp_no,ROUND( AVG(salary), 2),DATE_FORMAT(NOW(),'%m-%d-%Y') AS Today
FROM salaries
GROUP BY emp_no
LIMIT 10;
COLUMN HEADINGS:
| emp_no | ROUND( AVG(salary), 2) | Today |
I'd like to have something like
| emp_no | avgSal | Today |
Upvotes: 0
Views: 78
Reputation: 44844
You have already done it for date, just need to add another one for average salary.
SELECT emp_no,
ROUND( AVG(salary), 2) as avgSal,
DATE_FORMAT(NOW(),'%m-%d-%Y') AS Today
FROM salaries
GROUP BY emp_no
LIMIT 10;
Upvotes: 3