In Oracle, how do I add a generated column to my result-set? In other words, how do I do the following in Oracle:
SELECT (col4 * (col1+col2+col3) + 13) as gen1, *
FROM table1
WHERE col3 > 123
AND col4 = 5
ORDER BY col1, col2
This query works in MySQL and MSSQL. But for some reason, I can't get it to work with Oracle! Please help! Thanks
It should work if you qualify the * with the table name (or the alias name if you use one)
SELECT (col4 * (col1+col2+col3) + 13) as gen1, table1.*
FROM table1
WHERE col3 > 123
AND col4 = 5
ORDER BY col1, col2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With