自己紹介、初めてのポスターです。
私はそれが基本的なはずのように思えますが、これを動作させるには脳のブロックがあります。私は2つのデータセットを持っていますが、私はもう一方を比較して、セット1(実績)にあるレコードを(営業経費)に設定されていないものにしたいと思います。SQLで複数の特性を選択してください。
select distinct vacctcode, vEntityID
from tm1_fin_lines_integration
where vScenario = '507'
and vLineItemType = 'OperatingExpense'
これは、このようになります。データセットを返します。
私の2番目のクエリは、次のとおりです。
select i.property_externalid, i.externalid, r.lineitemtypename
from ivw_Actuals i
inner join rvw_accounts r on r.accountnumber = i.externalid
where r.LineItemTypeName = 'OperatingExpense'
and i.PropertyAssetId in .
(select vpropid from tm1_fin_lines_integration where vScenario = '507')
とリターンの結果のように:
運用経費の結果セットにない実績結果セットのレコードを検索したいとします。私はexternalid/vacctcodeとvEntityid/Property_ExternalIDで一致する必要があります。
どのように複数の特性にマッチするか分かりません。
このクエリは、1つのvEntityid/Property_ExternalIDを見ているときに機能しますが、実際には何百ものデータセットが表示されるため、アカウントコードとエンティティの組み合わせを見つける必要があります。営業費用セットに含まれていない実績セット。
select i.property_externalid,
i.externalid,
r.lineitemtypename
from ivw_Actuals i
inner join rvw_accounts r on r.accountnumber = i.externalid
where r.LineItemTypeName = 'OperatingExpense'
and i.PropertyAssetId in
(select vpropid from tm1_fin_lines_integration where vScenario = '507')
and i.externalid not in
(select distinct vacctcode, vEntityID
from
tm1_fin_lines_integration
where
vScenario = '507'
and vLineItemType = 'OperatingExpense')
どのDBMSを使用していますか? –
サンプルデータと期待される結果を見せてください。実際の結果セットに何が「運営経費にはない」とはっきりしない。 \t [** How-to-Ask **](http://stackoverflow.com/help/how-to-ask) \t \t [**スタート**] http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/)質問品質を向上させ、より良い回答を得る方法を学ぶことができます。 –