output table to obtain the rows
We want an output table to 开发者_JAVA技巧obtain the rows to simulate
DB:
SampleTable1
Name Product
Jan Book
Smith Glass
.... .....
select * from SampleTable1
i would like result This Select Same Below output.
outPut:
Row Name Product
1 Jan Book
2 Smith Glass
3 .... .....
In Access 2007
For Oracle you can do
select rownum as Row, Name, Product
from SampleTable1;
For mySql:
select @rownum := @rownum + 1 as Row, Name, Product
from SampleTable1, (select @rownum := 0)
For SQL Server:
select row_number() over (order by Name) as Row, Name, Product
from SampleTable1
SELECT Name, Product, row_number() OVER (ORDER BY Name) AS Row
FROM SampleTable1
In Mysql i think it would be like this:
select @rownum:=@rownum+1 slno, s.* from SampleTable1 s, (SELECT @rownum:=0) r
精彩评论