Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Statement Help
Message
De
02/11/2009 09:47:52
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
02/11/2009 09:41:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01432687
Message ID:
01432691
Vues:
40
>I have two tables as follows (not all fields listed):
>
>Table 1
>DrwNo  Lastrev  .........
>100         B
>101         C
>102         D
>etc....
>
>
>Table 2
>DrwNo    Revno .....
>100          0
>100          A
>100          B
>101          0
>101          A
>101          B
>101         C
>etc...
>
>
>What I would like to produce is the following cursor:
>
>
>Drwno       Revisions
>100           '0, A, B'
>101           '0, A, B, C'
>102           '0, A, B, C, D'   
>
>
>Is this possible with a single SQL statement? If so, can someone please point me in the right direction.
>
>Thanks,

I believe this is basically not possible - not with SQL alone - because that is not the way SQL works. Not even with several SELECT statements. You need a UDF that loops through each Drwno and creates the comma-delimited string. Once you have it, it is quite easy to add this as an additional (calculated) field. Make sure to CAST it to type memo.
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