Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sum memo fields
Message
De
05/03/2012 16:38:22
 
 
À
05/03/2012 16:31:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01537332
Message ID:
01537333
Vues:
50
>Hi All -
>
>It seems like I should know how to do this but for some reason I am drawing a blank. Suppose you have 2 tables in a 1 to many raltionship. Table1 contains data about various businesses.
>Table2 (child) contains notes (memo field) about those businesses.
>How do you write an sql that will sum the notes into a single field so that we end up with 1 record per business including a field with all of the notes?
>
>Something like
>
>SELECT table1.*, sum(table2.Notes) as Notes ;
>FROM table1;
>left join table2 ON key . . . .
>
>
> I might add that this is VFP data exposed on a asp website. The end game is to export all of the data to excel.
>Thanks for any help on this.
>I'm stumped. :)

In VFP the only way will be to create a custom UDF that will concatenate notes. I suggest to simply scan the table instead and create the concatenated Notes field.

In SQL Server you will use XML PATH('') approach for this.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform