Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index on multiple columns (fields)
Message
From
23/07/2003 00:44:24
 
 
To
22/07/2003 23:52:47
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00812633
Message ID:
00812651
Views:
21
Hi Hilmar,

Based on your ealier example I managed to find a way to sort Numeric fields, however still not sure about character fields, pls let me know if you know a way to so.

regards
shaishav
>How to do it, I explained in my other reply.
>
>But what you actually do would depend on the purpose.
>
>If you show the information in a grid, as part of an editing form, you might need the index.
>
>If it is for a report, the SELECT - SQL solution is easier. Everything you SELECT goes to a cursor, a temporary table, that is deleted automatically as soon as you close it.
>
>>Dear Hilmar,
>>
>>Thanks for your reply;
>>
>>Actually I want to sort fields in one table; can I sort one field on descending and other on ascending??
>>
>>Actually what I want is;
>>
>>I have a ItemsOrdered table; this table has the data in following format;
>>
>>OrederNo ItemCode(Primary Key) ItemNo ItemDate ItemQty
>>20030101 20030101-001 001 01/01/2003 15000
>>20030101 20030101-002 002 01/01/2003 30000
>>20030101 20030101-002 003 01/01/2003 45000
>>
>>20030301 20030301-001 001 01/03/2003 15000
>>20030301 20030301-002 002 01/03/2003 25000
>>20030301 20030301-003 003 01/03/2003 35000
>>
>>Please note that the First 8 letters of ItemCode represents OrderNo.
>>Last 3 digits represents ItemNo.
>>And also note that the ItemDate for each item within a OrderNo is same.
>>
>>If user wants to see ItemOrdered data in desc order of ItemDate:
>>It should display in desc order of ItemDate but maintaining the sequence of ItemNo, that means it should show as follows;
>>
>>OrederNo ItemCode(Primary Key) ItemNo ItemDate ItemQty
>>20030301 20030301-001 001 01/03/2003 15000
>>20030301 20030301-002 002 01/03/2003 25000
>>20030301 20030301-002 003 01/03/2003 35000
>>
>>20030101 20030101-001 001 01/01/2003 15000
>>20030101 20030101-002 002 01/01/2003 30000
>>20030101 20030101-003 003 01/01/2003 45000
>>
>>I don't want to use SELECT-SQL statement for this, because the information is available in a table. Can I define any Index tag to achieve this??
>>
>>TIA
>>
>>Shaishav
>>
>>>It can be done, but what do you need this index for? If you use indices are to ensure uniqueness of data, for referential integrity, or to search, it doesn't matter whether the index is ascending or descending (therefore, use an ascending index).
>>>
>>>If it is for a report, just use SELECT - SQL, with the ORDER BY clause. Here, you can explicitly use ASCENDING and DESCENDING for individual fields, and you don't need to concatenate everything into a single expression.
>>>
>>>>Hi Everyone,
>>>>
>>>>I want to index my table on two columns (item_code + item_date). I want to index in such way that,
>>>>
>>>>Item_date is sorted in descending order and item code is sorted on ascending order.
>>>>
>>>>E.g.
>>>>Item_code Item_date
>>>>========= =========
>>>>Item1 01/01/2003
>>>>Item2 01/01/2003
>>>>Item3 01/01/2003
>>>>Item1 01/04/2003
>>>>item2 01/04/2003
>>>>item3 01/04/2003
>>>>
>>>>The above should be displayed as;
>>>>Item_code Item_date
>>>>========= =========
>>>>Item1 01/04/2003
>>>>Item2 01/04/2003
>>>>Item3 01/04/2003
>>>>Item1 01/01/2003
>>>>item2 01/01/2003
>>>>item3 01/01/2003
>>>>
>>>>Any suggestions???
>>>>
>>>>Cheers
>>>>Shaishav
Regards
Shaishav
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform