Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
chandru_zylog
Starting Member
4 Posts |
Posted - 2008-03-20 : 03:31:23
|
| hai everybody,i have doubt With the Top(n) percent keywordfor example consider the table employee with following details i'm using a query SELECT TOP(19) PERCENT * FROM Employee if i execute this query im gettin 2 record set whose id is less than 6SELECT TOP(19) PERCENT * FROM Employee WHERE ID <6 like wise if i execute the above query i'm gettin only one record set instead of two record set ...why so, can anyone help me on this??... id name salary st_date city region1 Jason 40420 1994-02-01 00:00:00.000 New York W2 Robert 14420 1995-01-02 00:00:00.000 Vancouver N3 Celia 24020 1996-12-03 00:00:00.000 Toronto W4 Linda 40620 1997-11-04 00:00:00.000 New York N5 David 80026 1998-10-05 00:00:00.000 Vancouver W6 James 70060 1999-09-06 00:00:00.000 Toronto N7 Alison 90620 2000-08-07 00:00:00.000 New York W8 Chris 26020 2001-07-08 00:00:00.000 Vancouver N9 Mary 60020 2002-06-09 00:00:00.000 Toronto WThanks in Advance |
|
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2008-03-20 : 03:45:39
|
| 9 * 0.19 = 1.71 --> 2 records5 * 0.19 = 0.95 --> 1 record |
 |
|
|
jrogers
Starting Member
34 Posts |
Posted - 2008-03-20 : 03:46:48
|
| 19% of 9records is 1.71 so you get 2 records19% of 5 is 0.95 so you get 1 record.. are you trying to produce the top 19% of salary |
 |
|
|
chandru_zylog
Starting Member
4 Posts |
Posted - 2008-03-20 : 04:40:22
|
| Thanks for your response and now im clear about that. |
 |
|
|
|
|
|