Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select many to one
Message
 
À
18/07/2001 06:39:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00531898
Message ID:
00531912
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
Hi!
How about using user-defined function in SQL query for string concatenation?
Something like:
PUBLIC lastkey, resstr
lastkey = 0
resstr= ""
FUNCTION sumstr(fKey, fComment)
resstr = IIF(kKey != lstkey, resstr + fComment, "")
lastkey = fKey
END FUNC

SELECT keyfield, sumstr(keyfield, commentfield) FROM ... GROUP BY 1
It's not tested, just an idea.

>I recently created a report for an old application. In the app, the comments are stored as a series of six records with the table structure being a key field and then a 60 character field for the text. So for each comment there will be six records in the table. I wanted to select these into a memo field along with other fields from related tables for inclusion in a report.
>
>I selected the matching records with a sql select by the key field and then used a scan loop to gather the six records into a cursor to combine the six lines into one memo field. This works fine but I am wondering why I couldn't do this with a select statment and not have to rely on the scan loop. For some reason, I am drawing a blank.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform