0

以下のスクリプトで作成したばかりの空の列を更新しようとしています。実行しようとすると、次のエラー メッセージが表示されます (クエリ 1)。

ORA-00933: SQL command not properly ended

そのため、少しグーグルで検索し、わずかに異なるクエリ (クエリ 2) を使用してみましたが、次のエラー メッセージが表示されます。

ORA-00904: "T1"."PLAYED_PREVIOUS_YEAR": invalid identifier

これがなぜなのか知っている人はいますか?

クエリ 1:

update JWxsellallprod t1
   set t1.played_previous_year = case when t2.cust_id IS NOT NULL then 1 else 0 end
 from JWxsellallprod t1
 left join (select a.Year_of_Play,
                   a.Year_Aquired,
                   a.cust_id
              from JWxsellallprod a
             inner join JWxsellallprod b
                on b.cust_id = a.cust_id
             where a.player_days > 0
               and b.player_days > 0
               and b.Year_of_Play = a.Year_of_Play - 1
               and a.Year_Aquired = b.Year_Aquired
           ) t2
   on t2.cust_id = t1.cust_id
  and t2.Year_of_Play = t1.Year_of_Play
  and t2.Year_Acquired = t1.Year_Acquire;

クエリ 2

update JWxsellallprod t1
   set t1.played_previous_year
      = (select case when t2.cust_id IS NOT NULL then 1 else 0 end
           from JWxsellallprod t1
           left join (select a.Year_of_Play,
                             a.Year_Aquired,
                             a.cust_id
                        from JWxsellallprod a
                       inner join JWxsellallprod b
                          on b.cust_id = a.cust_id
                       where a.player_days > 0
                         and b.player_days > 0
                         and b.Year_of_Play = a.Year_of_Play - 1
                         and a.Year_Aquired = b.Year_Aquired
                     ) t2
             on t2.cust_id = t1.cust_id
            and t2.Year_of_Play = t1.Year_of_Play
            and t2.Year_Acquired = t1.Year_Acquire);
4

1 に答える 1