我會盡我所能解釋我想要完成的工作。基於子集數據結果的SQL返回值
我有下面的數據子集的表:
ID BF_ID C_ID T_ID
1 1 10000 182
2 1 230 null
3 2 123 null
4 3 10000 124
基本上我想查詢基礎上,BF_ID
這個表,看是否有數據存在一種既具有不爲空T_ID
和一結果中不爲空C_ID。
在上面的例子中,我想區分在不同的BF_ID之間查詢。 BF_id的行數可能是無限的。
- BF_ID爲1會返回「混合」。
- 的2 BF_ID將返回 「C_ID_ATTRIB」
- BF_ID 3將返回 「T_ID_ATTRIB」
您使用哪種rdbms? – Khan
我正在使用Boracle;) – KingKongFrog
我不確定我是否理解爲什麼1的bf_id與3的bf_id不同。在'C_ID'和'C_ID'中都顯示非空數據'T_ID'列。但是應該返回「混合」,而另一個應該返回「T_ID_ATTRIB」。什麼是邏輯,讓你區分這兩個? –