How To Calculate Limit In Sql