Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I build that SQL
Message
De
16/03/2005 15:31:02
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Database:
Visual FoxPro
Divers
Thread ID:
00996490
Message ID:
00996500
Vues:
10
>Try this
>
>SELECT * FROM MyTable WHERE LEN(ALLTRIM(Code)) == 2 INTO CURSOR cCursor1
>
>SELECT PADR(IIF(LEN(ALLTRIM(MyTable.Code))==2,"",ALLTRIM(cCursor1.Description)+" ")+MyTable.Description,100) AS Description;
>       FROM MyTable;
>       LEFT JOIN cCursor1 ON LEFT(MyTable.Code,2)+"  "==cCursor1.Code;
>INTO CURSOR cCursor2
>BROW
>
I should've given more details in the beginning. I just hoped that someone would give me something and that I would be able to continue from that point on my own. But from what you gave me I realize that not giving all details can lead those trying to help possibly in the wrong direction.

So let me give me more information on the category and sub-category functionalities in my app.

Top category can go from "01" to "99". Created by user. Always two digits per category

For each category there can be sub-categories but also sub-categories for that sub-category. So in all with main category its five levels deep.

So identification for a category could be at some point "7501020304" and description for that sub-category be "04". So in that case I'd need to have all the portions before the "04". So that means descrition for "75" and then "7501" and then "750102" and then "75010203" and finally "7501020304".

Description for "75" could be "Movies"
Description for "7501" could be "DVD"
Description for "750102" could be "Comedy"
Description for "75010203" could be "2005"
Description for "7501020304" could be "Robin Williams"

So in my cursor I'd have "Movies, DVD, Comedy, 2005, Robin Williams"

Sorry for not specifying that to begin with.
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform