2016-06-12 6 views
1

items.unit_priceをサブクエリ内で10%増やして別の列に表示しようとしています。ここでサブクエリの値を変更する問題がある

は私のコード

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" 
) 
; 
+0

あなたのタイトルは完全にナンセンスです。修正して、私はダウンボートを削除します。 – peterh

+0

これは良いですか? –

+0

はい、私はdownvoteを上に変更しました。ありがとう! – peterh

答えて

1

が何をしたい、このですか?

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; 
+0

サブクエリを使用しています。あなたが掲示したものはサブクエリとみなされますか?私は本当に知らないので。 –

+1

*私はサブクエリを使用しています* ...これは宿題の問題ですか? – Parfait

+0

それはプロジェクトのために、私は多かれ少なかれ問題が何かを考え出したと思う。 –

関連する問題