| Author |
Topic  |
|
|
gsvnreddy
Starting Member
India
3 Posts |
Posted - 06/13/2007 : 05:13:44
|
How to display even number records from a table.
Example: Suppose there is a table Temp, this table contains one column names. Suppose this table contains data like this,
names
Jacob Nutan Newton Franco Ramco Lanco
etc, from this Temp table how to select even number records, which are Nutan,Franco,Lanco etc.
Please help me.
|
|
|
harsh_athalye
Flowing Fount of Yak Knowledge
India
5509 Posts |
Posted - 06/13/2007 : 05:19:43
|
For determining even/odd records, it is must to assign row numbers and for generating row number, it is necessary to decide order of the records. So which field decides order of values? Clearly it is not alphabetic order.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 06/13/2007 : 06:28:13
|
Add an identity column to your temp table and then
select * from #temptable where identcol % 2 = 0
Peter Larsson Helsingborg, Sweden |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 06/13/2007 : 06:29:05
|
But you better post you full problem here roght away. I have a suspicion that you will post next related problem here within hours...
Peter Larsson Helsingborg, Sweden |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
|
|
harsh_athalye
Flowing Fount of Yak Knowledge
India
5509 Posts |
Posted - 06/13/2007 : 08:43:00
|
None of the solutions in that thread is helpful unless you have an identity column.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
India
22461 Posts |
Posted - 06/13/2007 : 09:03:47
|
quote: Originally posted by harsh_athalye
None of the solutions in that thread is helpful unless you have an identity column.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED"
May be NTILE Function will help 
Madhivanan
Failing to plan is Planning to fail |
 |
|
|
harsh_athalye
Flowing Fount of Yak Knowledge
India
5509 Posts |
Posted - 06/13/2007 : 09:06:38
|
quote: Originally posted by madhivanan
quote: Originally posted by harsh_athalye
None of the solutions in that thread is helpful unless you have an identity column.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED"
May be NTILE Function will help 
Madhivanan
Failing to plan is Planning to fail
Not unless there is an ORDER BY clause, which is what my original question is.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
Posted - 06/13/2007 : 09:22:32
|
quote: Originally posted by harsh_athalye
None of the solutions in that thread is helpful unless you have an identity column.
Harsh Athalye India. "The IMPOSSIBLE is often UNTRIED"
I doubt that any of the solutions on that thread could be called "helpful", with or without an identity column. 
CODO ERGO SUM |
 |
|
| |
Topic  |
|