Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Concatenating strings w/ SQL SELECT
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00539337
Message ID:
00539349
Vues:
15
It cannot be done with sql select in VFP but you can do it in the code
SELECT 0
CREATE CURSOR Mycursor ( Name C(60), code C(1))

SELECT Mytable
SET ORDER TO code
LOCATE
lcCode = code
lcName = Trim(Name)
DO WHILE NOT EOF()
  SKIP
  SCAN WHILE code = lcCode
    lcName = lcName + ", " + Trim(Name)
  ENDSCAN
  INSERT INTO Mycursor VALUES (lcName, lcCode)
  lcCode = code
  lcName = Trim(Name)
ENDDO
>I have a table:
>
>Name code
>text1 2
>text2 2
>text3 2
>text4 3
>text5 3
>
>I want to create a cursor gruped by code w/ concatenated Name field:
>
>Cursor1
>Name code
>Text1, Text2, Text3 2
>Text4, Text5 3
>
>but I don't know how:
>
>SELECT ???? AS Name, Code FROM MyTable GROUPED BY MyTable.Code INTO CURSOR Cursor1.
>
>
>TIA
>
>
>Boris
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform