在2个表的连接查询时,
select * from t1 inner join t2 where t1.PageID =t2.ID and t2.BookID=1 order by t1.PageID
查询结果是满足条件的t1表中的记录,想知道如何获取结果集中某行的行号?
Sql sever中的方法是这样的,
select IDENTITY(int, 1,1) as row_no,* into pp from page
select * from #temp
不过sqlite貌似不支持这样
------解决方案--------------------------------------------------------
select *,rowid from (
select * from t1 inner join t2 where t1.PageID =t2.ID and t2.BookID=1 order by t1.PageID) a
rowid在SQLITE中可以用
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
SQLite 中的rowid 如2楼所述,并不是SQL server或者 oracle 中的概念。
你需要用其它方法来实现。比如 select * , (select count(*) from table1 where id<=a.id) as rowid from table1 a order by id;
具体你可以参考下贴。
http://blog.csdn.net/ACMAIN_CHM/archive/2009/04/20/4095531.aspx