I have a SQL Server table AccountActionthat is being denormalized. This is a flattened version of the tables Accountand Actionwhich, I hope, should be much faster to send queries across millions of rows. One Accountcan have many Actions, so the table looks like this:
Account Action
account1 action1
account1 action2
account1 action10
account2 action5
However, I had problems returning information for a limited subset in a simple stored procedure.
select Account, Action
from AccountAction
where ???
I am looking to get the first X accounts, with all their actions. Thus, it will be a dynamic number of rows. Therefore, using the example table above, if I passed in 1, I would get 3 rows (i.e., provided me with all the rows for the first account).
( , - )
ROWNUM ? , , .
TOP , 3 , " () ". , 3? . , , account1 action99 55 .