Skip to content
Advertisement

Add new column in SQL query

I want to use the result of query to create new column in order to to find the change of freight to the revenue

The original question is What is the impact on revenue of the additional 10% in freight. I am currently using Northwind dataset

SQL query does not work as it does not recognize new variable “New” and “Old”

I have updated the version that suggessted but it generate error messange

Advertisement

Answer

You can use the columns New and Old after they are run in a subquery

But your (sub)query will not give you a correct result as

is a cross join between both tables and would return too many rows to give you the expected result

So you would

And then you still must check if the result is what you are looking for

In end effect it will lokk like

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement