Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select many to one
Message
De
18/07/2001 13:55:39
 
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:
00532139
Vues:
13
Thanks for the reply Alexander,

That is a little better but still not exactly what I was looking to do. <g> Maybe I can't think of a way to do it becasue there is no straightforward SQL command to do it. :-) I was just wondering how I would handle this if I were working with SQL Server and didn't have some of the VFP functionality.

Bill

>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
Répondre
Fil
Voir

Click here to load this message in the networking platform