获取会计软件中的剩余帐户

时间:2015-04-20 12:36:39

标签: c# sql select

我遇到了问题

SELECT Tbl_ZAsnad.zs_id ,
       V_ALLAccounts.h_name ,
       zs_bed ,
       zs_bes ,
       (SELECT SUM(Tbl_ZAsnad.zs_bed) - SUM(Tbl_ZAsnad.zs_bes) FROM Tbl_ZAsnad
        WHERE k_code = 12 and m_code = 2 and t_code = 10 and zsid < "***GET Current value of zs_id***")
FROM Tbl_ZAsnad , V_ALLAccounts
WHERE k_code= kid
and m_code = mid 
and t_code = tid
and k_code = 12 and m_code = 2 and t_code = 10  

我想获得zs_id的当前值

2 个答案:

答案 0 :(得分:0)

您必须指定外部Tbl_ZAsnad,现在称为t1:

SELECT t1.zs_id ,
       V_ALLAccounts.h_name ,
       zs_bed ,
       zs_bes ,
       (SELECT SUM(t2.zs_bed) - SUM(t2.zs_bes) FROM Tbl_ZAsnad t2
        WHERE k_code = 12 and m_code = 2 and t_code = 10 and zsid < t1.zs_id)
FROM Tbl_ZAsnad t1, V_ALLAccounts
WHERE k_code= kid
and m_code = mid 
and t_code = tid
and k_code = 12 and m_code = 2 and t_code = 10  

答案 1 :(得分:0)

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <fragment
            android:id="@+id/google_map"
            class="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_weight="1" />
    </LinearLayout>
</FrameLayout>
<!-- The navigation drawer -->
<LinearLayout
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:gravity="bottom|center"
    android:orientation="vertical">

    <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/swipe_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="#ffffff"
            android:choiceMode="singleChoice"
            android:divider="@android:color/darker_gray"
            android:dividerHeight="0dp" />
    </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>

/////显示此消息:

  

字符串或二进制数据将被截断。

     

字符串或二进制数据将被截断。

     

INSERT语句与FOREIGN KEY约束冲突   &#34; FK_Tbl_ZAsnad_Tbl_Asnad&#34 ;.冲突发生在数据库中   &#34; Autogallery_DB&#34;,table&#34; dbo.Tbl_Asnad&#34;,column&#39; s_id&#39;。

     

INSERT语句与FOREIGN KEY约束冲突   &#34; FK_Tbl_ZAsnad_Tbl_Asnad&#34 ;.冲突发生在数据库中   &#34; Autogallery_DB&#34;,table&#34; dbo.Tbl_Asnad&#34;,column&#39; s_id&#39;。

     

声明已经终止。

     

声明已经终止。

     

声明已经终止。

     

声明已经终止。