Using a Stored Procedure to calculate percentage of records from a table

  • I am trying to figure out the simplest way to get two percentages of records from a table.  If a table is refreshed and contains 25 records I want to get then first 25% and do....Then I want to get the rest (75%) the do....The end result will be put in a file and emailed to the corresponding two addresses.

    Thanks,

     

  • Hi Ron

    how about using a mixture of SELECT TOP and ORDER BY?

    for example, if you do SELECT TOP 25% and ORDER BY a certain column, that should get your first 25%, then if you do SELECT TOP 75% and order by the same column DESCENDING, that should get the rest...or vice versa if you are ordering by a date column and wanting to get the most recent first.

    hope this helps.

    Charlotte.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply