Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
For advocates of surrogate foreign keys
Message
De
27/11/1998 22:56:29
 
 
À
27/11/1998 11:57:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00161970
Message ID:
00162086
Vues:
25
>For those that advocate using surrogate foreign keys (non-business key) I have a question. How do you best handle sorting on a foreign key? For example, I have an Ap invoice table with a foreign key to my vendor table (unique integer). I don't have any way to SET ORDER to my vendor field to easily sort my invoices by vendor id. I could bag the integer foreign key in the Invoice table and replace it with the vendor id itself or I could include both the integer key value and the actual vendor id in my invoice table. I like using the integer for speed, ease of use, etc. and although it violates normalization, it may be helpful to have both for sorting. Any suggestions?

Seems to me, it depends on why you want to order the query. If you only want to order the query by vendor, so they are grouped togther, just order by the FK... whats the big deal, which is what it seems like you want to do, since I am sure your vendor id wouldn't put them in ABC order.

If for any other reason you want to order by a field in the vendor file, do a join. That is why you are using FK's and integer keys (faster) and indexes, right?

BOb
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform