Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query/Output a Sequence

Status
Not open for further replies.

glofishing

Technical User
Jul 24, 2007
1
US
Hi,

I have a table that need to be sorted with a sequence of values. A field has a numeric value:

[seqorder] will have a numeric value 1-5. I need to query records that will create a sequenced output and then repeat this sequence. So, I query a table and the output would be sorted like this:

Record 1 [seqorder] = 1
Record 2 [seqorder] = 2
Record 3 [seqorder] = 3
Record 4 [seqorder] = 1
Record 5 [seqorder] = 2
Record 6 [seqorder] = 3

ETC...

Thanks!

glofishing

 
you want the integer division operator...

select col, col % 3 as repeatingSequence
from table...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top