2016-11-28 10 views
0
if 1=(select oneTimePayClass from tblClass where [email protected]) 
    print 'True'; 
else 
    (select h.FeeHeadId,h.FeeHeadName,d.amount,d.FeeDefaultId 
    from tblFeeHead as h inner join tblFeeDefault as d on h.feeHeadId=d.feeHeadId 
    where [email protected] and [email protected] and [email protected] and [email protected] and [email protected] 
    order by h.orderNr); 

order by h.orderNrを削除すると、クエリは正常に実行されます。SQLサーバークエリの表示エラーが正しくありません。

しかし、私はorder by h.orderNrを追加するとき、それは示しています

エラー正しくない構文順

+1

のようにそれを実行し、最終的なSQL文 –

答えて

1

近くORDER BY句はビュー、インライン関数、派生テーブル、サブクエリ、および共通のテーブルに無効です表現。

この

if 1=(select oneTimePayClass from tblClass where [email protected]) 
    print 'True'; 
else 
    select h.FeeHeadId,h.FeeHeadName,d.amount,d.FeeDefaultId 
    from tblFeeHead as h inner join tblFeeDefault as d on h.feeHeadId=d.feeHeadId 
    where [email protected] and [email protected] and [email protected] and [email protected] and [email protected] 
    order by h.orderNr; 
+0

からブラケットを取り外し非常に仲間のuに感謝 –

関連する問題