Author |
Topic |
gsvnreddy
Starting Member
3 Posts |
Posted - 2007-06-13 : 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,namesJacobNutanNewtonFrancoRamcoLancoetc, from this Temp table how to select even number records, which are Nutan,Franco,Lanco etc.Please help me. |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-13 : 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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-13 : 06:28:13
|
Add an identity column to your temp table and then select * from #temptable where identcol % 2 = 0Peter LarssonHelsingborg, Sweden |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-13 : 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 LarssonHelsingborg, Sweden |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-13 : 08:43:00
|
None of the solutions in that thread is helpful unless you have an identity column.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-13 : 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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
May be NTILE Function will help MadhivananFailing to plan is Planning to fail |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-06-13 : 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 AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
May be NTILE Function will help MadhivananFailing to plan is Planning to fail
Not unless there is an ORDER BY clause, which is what my original question is.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-06-13 : 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 AthalyeIndia."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 |
|
|
|