下午
我有一个选择陈述
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="4"
tools:context="com.PinchZoom.pinchzoomexampletwo.MainActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="@+id/img_back"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/img_back_description"
android:src="@drawable/back_icon"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="@string/txt_app_name"
android:textSize="35px"
android:textStyle="bold" />
<ImageView
android:id="@+id/img_menu"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/img_menu_description"
android:src="@drawable/menu_icon" />
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:background="@drawable/linear_layout_square"
android:gravity="center" >
<com.PinchZoom.pinchzoomexampletwo.TouchImageView
android:id="@+id/img_to_be_zoomed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img" >
</com.PinchZoom.pinchzoomexampletwo.TouchImageView>
<com.PinchZoom.pinchzoomexampletwo.TouchImageView
android:id="@+id/img_to_be_zoomed_mirror"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img" >
</com.PinchZoom.pinchzoomexampletwo.TouchImageView>
</RelativeLayout>
<LinearLayout
android:id="@+id/layout_bottom_hscrolling"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_weight="0.5"
android:gravity="bottom"
android:orientation="horizontal" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/horizontal_list_view"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ddd" >
</com.devsmart.android.ui.HorizontalListView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_bottom_hscrolling_first"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="gone" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/horizontal_list_view_first"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ddd" >
</com.devsmart.android.ui.HorizontalListView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_bottom_hscrolling_second"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="gone" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/horizontal_list_view_second"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ddd" >
</com.devsmart.android.ui.HorizontalListView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_bottom_hscrolling_third"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="gone" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/horizontal_list_view_third"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ddd" >
</com.devsmart.android.ui.HorizontalListView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_bottom_hscrolling_fourth"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="gone" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/horizontal_list_view_fourth"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#ddd" >
</com.devsmart.android.ui.HorizontalListView>
</LinearLayout>
</LinearLayout>
我希望只在SIC_SupplierProductCode表上选择,如果SIC_ProductDetails选项卡中没有值forund
这是否意味着使用案例,因为我要回到太多行。那是因为我认为OR语句。我只是不知道如何写它。
我不知道如何编写IF语句
答案 0 :(得分:1)
您可能还需要一个OR
条件
SELECT 1
FROM SIC_ProductDetails p
WHERE p.SIC_IdSupportedInitiative = 61
AND ( p.SIC_SupplierProductCode = sc.[Product Code] --here
OR p.SIC_SupplierProductCode = (SELECT sp.SIC_SupplierProductCode
FROM SIC_SupplierProducts sp
WHERE sp.SIC_IdSupplier = 6
AND sp.SIC_SupplierProductCode = sc.[Product Code]) ) --here
答案 1 :(得分:0)
你可以尝试这个查询
SELECT
sc.[Actual Posting Date],
sc.[Product Code]
FROM SalesCurrent sc
INNER JOIN SIC_ProductDetails p ON p.SIC_SupplierProductCode = sc.[Product Code] AND p.SIC_IdSupportedInitiative = 61
INNER JOIN SIC_SupplierProducts sp ON sp.SIC_SupplierProductCode = sc.[Product Code] AND sp.SIC_IdSupplier = 6
WHERE sc.[Customer Account] = 'BLUF008' AND sc.[Accounting Branch] = 117