count - Counting Retrieved Records from SQL Server -
i want inquire if how may able create dynamic numbering column based retrieving database?
ex.
table reservations |reservationno----clientno------dateadded----datemodified| |1 | 1 | 01-01-01 | 01-01-01 | |2 | 2 | 01-01-01 | 01-01-01 | |3 | 2 | 01-01-01 | 01-01-01 | |4 | 2 | 01-01-01 | 01-01-01 | |5 | 1 | 01-01-01 | 01-01-01 | |6 | 3 | 01-01-01 | 01-01-01 | |7 | 3 | 01-01-01 | 01-01-01 | |8 | 2 | 01-01-01 | 01-01-01 | |9 | 1 | 01-01-01 | 01-01-01 | |10 | 1 | 01-01-01 | 01-01-01 |
when execute statement below...
select * table clientno = '1'
result :
**counter**-----reservationno----client--------dateadded----datemodified| |1 | 1 | 1 | 01-01-01 | 01-01-01 | |2 | 5 | 1 | 01-01-01 | 01-01-01 | |3 | 9 | 1 | 01-01-01 | 01-01-01 | |4 | 10 | 1 | 01-01-01 | 01-01-01 |
looks you're searching row_number function, see http://msdn.microsoft.com/de-de/library/ms186734.aspx
sql-server count records
No comments:
Post a Comment