我需要将npgsql查询转换为Linq查询。 Npgsql看起来像:
<activity android:label="@string/app_name" android:launchMode="singleTask"
android:name=".activities.LoginActivity" android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="myhost.com"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
我尝试转换:
p.cmd = new NpgsqlCommand("select distinct min(h_dt::date) from w_h " +
"inner join us on h_us_id = us_id " +
"where cat_id != '' and h_dt::date not in (select distinct period_date from m_v " +
"where mv_id = 1)", conn);
我需要帮助添加这部分比较:
和h_dt :: date not in(从m_v中选择不同的period_date)
h_dt :: date - 以yyyy-MM-dd格式返回日期
答案 0 :(得分:1)
有另一个集合来保存这些结果:
// pseudocode ! write your selection here:
var v = select distinct period_date from m_v
然后简单地与contains进行比较:
q.Where(i=> ! v.Contains(i) );