1、如果是SQL的话,可以用下面的方式select top 7 * from table order by newid( )2、如果是Oracle select * from ( select * from table order by dbms_random.value ) where rownum <= 7; 3、如果是AccessSELECT top 7 * FROM table ORDER BY Rnd(id) ID是自增长一个列4、如果是MySQLselect * from table order by rand() limit 7
分页并取其中某段显示,如每页显示7条,共有总记录/7 条记录, select * from ( select top n * from Table1 where id not in (select top m * from Table1 order by id) as t1 order by id) as t2 ) 差不多就这个意思
protected void Page_Load(object sender, EventArgs e) { int counter = 0; if (!IsPostBack) { this.ViewState["counter"] = counter; } else { int current = Convert.ToInt32(this.ViewState["counter"]); current++; this.ViewState["counter"] = current; }
//do your counter query here Response.Write(this.ViewState["counter"].ToString());}
什么样的不重复?是每七个不重复还是每七个中都不能重复阿?每七个不重复: order by newid() 每七个中都不重复:随便整机个排序 然后七个一页分页
select * from (
select * from table
order by dbms_random.value
)
where rownum <= 7; 3、如果是AccessSELECT top 7 * FROM table ORDER BY Rnd(id) ID是自增长一个列4、如果是MySQLselect * from table order by rand() limit 7
select * from
(
select top n * from Table1 where id not in
(select top m * from Table1 order by id) as t1 order by id) as t2
)
差不多就这个意思
{
int counter = 0;
if (!IsPostBack)
{
this.ViewState["counter"] = counter;
}
else
{
int current = Convert.ToInt32(this.ViewState["counter"]);
current++;
this.ViewState["counter"] = current;
}
//do your counter query here
Response.Write(this.ViewState["counter"].ToString());}
每七个中都不重复:随便整机个排序 然后七个一页分页