nathan rivera nathan rivera -5 years ago 97
MySQL Question

Having issues changing values in a sub query

I am trying to take items.unit_price, increase it's value by 10% inside a subquery and then display it in another column.

Here is my code

select items.title, items.unit_price, items.unit_price as Price_increase
from artists
join items
on items.artist_id = artists.artist_id
order by price_increase in
select distinct round(items.unit_price + (items.unit_price * 0.1), 2) as Price_increase
from artists
where artists.artist_name = "No Rest For The Weary"

Answer Source

Is this what you want?

select i.title, i.unit_price,
       (case when a.artist_name = 'No Rest For The Weary'
             then 1.1*i.unit_price else i.unit_price
        end) as Price_increase
from artists a join
     items i
     on i.artist_id = a.artist_id
order by price_increase;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download