所以我做了这个:
select (
SELECT COUNT (*)
from TXN_TOTO
WHERE (CO1 = '1L' OR CO1 = '1') AND OP1 in('P3', 'R1')
) as A,
(
SELECT COUNT (*)
from TXN_TITI
WHERE (CO1 = '1L' OR CO1 = '1') AND OP1 in('P3', 'R1') AND STAT = 6
) as B,
(
SELECT COUNT (*)
from T_TITI tti inner join T_TATA ttdi
ON tti.ID_DINT = ttdi.ID_DINT
WHERE (CO1 = '1L' AND OP1 in('01', '04', 'Z8')) OR (CO1 = '1' AND OP1 in('P3', 'R1')) AND COM = 'O'
) as C
FROM DUAL;
我得到的结果如下:
A | B | C
----------
7 | 1 | 9
TXN_TOTO和TXN_TITI表都有一个“分”列,我想对其进行过滤以获取
CENT | A | B | C
----------------
0 | 2 | 0 | 0
1 | 2 | 1 | 4
2 | 3 | 0 | 5
因为我从2个不同的表中获取数据,所以我真的不知道该怎么做。
感谢。
TXN_TOTO
ID_DINT | CO1 | OP1 | DID_CENT
------------------------------
1 2L Z3 088
2 1L 1 089
3 1 P3 155
4 1L Z3 155
5 1L 1 077
6 1 P3 077
7 1L Z3 077
8 1L 1 077
9 1 P3 022
TXN_TITI
ID_DINT | CO1 | OP1 | DID_CENT |STAT
------------------------------------
1 2L Z3 088 6
2 1L 1 089 6
3 1 P3 155 6
4 1L Z3 155 6
5 1L 1 077 6
6 1 P3 077 6
7 1L Z3 077 6
8 1L Z8 077 6
9 1 R1 022 5
TXN_TATA
ID_DINT | COM |
---------------
1 O
2 O
3 O
4 O
5 N
6 O
7 O
8 O
9 O
Expected results :
DID_CENT | A | B | C
155 1 1 0
077 1 1 1
022 1 0 0
A仅从TXN_TOTO计算 B仅从TXN_TITI计算,只有差异是stat列 C是TITI和TATA的连接,你需要在TATA中有一个O
答案 0 :(得分:1)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:orientation="horizontal"
android:id="@+id/layout_main_container"
android:gravity="right">
<ImageView
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:id="@+id/chat_left_post"
android:contentDescription="@string/desc_list_item_icon"
android:visibility="gone"
android:src="@drawable/chat_left_post"/>
<LinearLayout
android:id="@+id/layout_content_all_items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:background="@drawable/listview_item_chat_left_shape"
android:minWidth="120dp"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="120dp"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="@+id/list_item_chat_post_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/bee_text_default_color"
android:textSize="12sp"
android:layout_gravity="left" />
<TextView
android:id="@+id/list_item_chat_post_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:textColor="@android:color/black"
android:layout_below="@+id/list_item_chat_post_date"
android:layout_marginTop="10dp"
android:visibility="gone"
android:textSize="16sp" />
<RelativeLayout
android:id="@+id/layout_player_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_centerVertical="true"
android:layout_below="@+id/list_item_chat_post_date"
android:orientation="vertical">
<ImageButton
android:id="@+id/btnPlayAudioStreaming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:contentDescription="@string/listen_voice_message"
android:scaleType="centerCrop"
android:layout_centerVertical="true"
android:src="@drawable/ic_action_play"
android:tag="1" />
<SeekBar
android:id="@+id/skbAudioCurrentState"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/btnPlayAudioStreaming"
android:layout_toEndOf="@+id/btnPlayAudioStreaming"
android:layout_marginLeft="5dp"
android:layout_marginTop="14dp"
/>
<TextView
android:id="@+id/lblCurrentDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/bee_text_default_color"
android:textSize="12sp"
android:layout_below="@+id/skbAudioCurrentState"
android:layout_toRightOf="@id/btnPlayAudioStreaming"
android:layout_marginLeft="22dp"
android:visibility="visible" />
<TextView
android:id="@+id/lblTotalDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/bee_text_default_color"
android:textSize="12sp"
android:layout_below="@+id/skbAudioCurrentState"
android:layout_alignEnd="@+id/skbAudioCurrentState"
android:layout_alignRight="@+id/skbAudioCurrentState"
android:layout_marginRight="18dp"
android:visibility="visible" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:contentDescription="@string/desc_list_item_icon"
android:src="@drawable/chat_right_post"
android:id="@+id/chat_right_post"/>
</LinearLayout>
</LinearLayout>
答案 1 :(得分:0)