22,210
社区成员
发帖
与我相关
我的任务
分享
select top 42 * from View_jydhwxx where fgsbm in (101) and dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032) and jhrq >= '2012-08-10 16:49:06' and jhrq <= '2012-08-17 16:49:06' and jydbh not in (select top 0 jydbh from View_jydhwxx where fgsbm in (101) and jhrq >= '2012-08-10 16:49:06' and dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032) and jhrq <= '2012-08-17 16:49:06' order by jydbh desc) order by jydbh desc
select top 42 * from View_jydhwxx where fgsbm in (101) and dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032)
and jhrq >= '2012-08-10 16:49:06' and jhrq <= '2012-08-17 16:49:06' and jydbh not in (select top 42 jydbh from View_jydhwxx
where fgsbm in (101) and jhrq >= '2012-08-10 16:49:06' and dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032)
and jhrq <= '2012-08-17 16:49:06' order by jydbh desc) order by jydbh desc
public DataSet GetRegionsInfo(int start, int limit,string jdsj1,string jdsj2,string fgsbm,string zxmc)
{
DataSet ds_zx = sqlhelper.GetDataSet("select FDz_id from bm_zxxxmx where Fzx_id in (" + zxmc + ")");
int size = ds_zx.Tables[0].Rows.Count;
string result = null;
for (int i = 0; i < size; i++)
{
result += ds_zx.Tables[0].Rows[i]["FDz_id"].ToString() + ",";
}
result = result.TrimEnd(',');
try
{
string sql = "select top " + limit + " * from View_jydhwxx where fgsbm in (" + fgsbm + ") and jhrq >= '" + jdsj1 + "' and jhrq <= '" + jdsj2 + "' and jydbh not in(select top " + start + " jydbh from View_jydhwxx where fgsbm in (" + fgsbm + ") and jhrq >= '" + jdsj1 + "' and jhrq <= '" + jdsj2 + "' order by jydbh desc) order by jydbh desc";
ds = sqlhelper.GetDataSet(sql);
return ds;
}
catch (Exception)
{
throw;
}
}
select top 42 * from View_jydhwxx
where fgsbm=101
and dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032)
and jhrq between '2012-08-10 16:49:06' and '2012-08-17 16:49:06'
and not exists (select 1 from View_jydhwxx t
where t.fgsbm=101
and t.jhrq between '2012-08-10 16:49:06' and '2012-08-17 16:49:06'
and t.dzzbm in (043,065,006,839,008,546,118,312,512,535,021,061,023,714,020,123,017,007,032)
and t.jydbh=jydbh)
order by jydbh desc