General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>I'm trying to create an index that will internally change back and forth between Ascending and Descending depending on the value of a field.
>>
>>Let's say I have a table with the following fields and values.
>>
>>cValue AorD
>>01 A
>>02 A
>>03 D
>>04 D
>>05 A
>>06 A
>>07 D
>>08 D
>>
>>I want to index on cValue Descending but internally cValue would be subIndexed as either Ascending or Descending depending on the value of AorD so that the final index would produce the following result.
>>
>>cValue AorD
>>01 A
>>02 A
>>04 D
>>03 D
>>05 A
>>06 A
>>08 D
>>07 D
>>
>>Can anyone think of a way to do this even using UDFs if needed?
>>
>>Ed
>
>Maybe you could have all your "D" type records be negative values (at least for your index)?
Even though the cValue field is character I could Index on VAL() but I believe that putting a negative value on the "D" records would put all of the "D" records on top and not interspersed as they need to be. The real headache is to have Ascending and Descending values interspersed among themselves. I've even been trying SQL SELECT to try and get a cursor in this order but I haven't been able to think of a scheme yet.
Ed
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only