Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert rows into columns
Message
De
07/06/2003 18:00:01
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00797678
Message ID:
00797681
Vues:
35
>Hi y'all.
>I need to obtain a cursor with one column for each row corresponding to a code in a master tabla, let me explain further..
>There is a parent table and a child table, both have a field called "cedula" which i use to join them, the chilt table has another fiel called "curso" which contains the code of an item, what i need is to obtain a cursor with the following structure:
>
>cedula,curso1,curso2,curso3,curso4......cursoN
>
>I made a program that works with macro substitution and creating N cursors which i join at the end, but i think there must be a better way..
>
>Is that possible?? how??
>
>Thanks in advance.
>
>jonamart@cantv.net

Here are some ideas:

I don't think you can do this in a few commands. However, you could use SQL - SELECT, with a UNION, to combine the tables vertically. The problem is, the individual parts must be "union compatible", meaning they have to have exactly the same fields. Perhaps this is a little bit simpler than your current approach, perhaps it isn't.

For a loop, you can use the field() function to return a field at a specific position. This might be of help, too.

I assume you need this for some kind of report. Perhaps the report is done easier with Excel, using Automation - if this is an option for your system.

Saludos,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform