Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL and Memos
Message
 
 
À
07/07/2005 10:07:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01029926
Message ID:
01029933
Vues:
13
If you know the max # of entries in the block field
CREATE CURSOR mytable (drwno C(15), block M)
INSERT INTO mytable VALUES( "1", "10,11")
INSERT INTO mytable VALUES( "2", "10")
INSERT INTO mytable VALUES( "3", "11")
INSERT INTO mytable VALUES( "4", "11,12,13")

SELECT drwno, PADR(MLINE(CHRTRAN(block, ",", CHR(13)),1),5) AS oneblock ;
	FROM mytable ;
	HAVING NOT EMPTY(oneblock) ;
UNION ALL ;
SELECT drwno, PADR(MLINE(CHRTRAN(block, ",", CHR(13)),2),5) AS oneblock ;
	FROM mytable ;
	HAVING NOT EMPTY(oneblock) ;
UNION ALL ;
SELECT drwno, PADR(MLINE(CHRTRAN(block, ",", CHR(13)),3),5) AS oneblock ;
	FROM mytable ;
	HAVING NOT EMPTY(oneblock)
>I have a table that contains the following two fields (along with others):
>
>
>drwno C(15)     block M
>1                 10,11
>2                 10
>3                 11
>4                 11,12,13
>
>
>Is there a way using sql to return the following cursor:
>
>
>drwno C(15)     block C(5)
>1                 10
>1                 11
>2                 10
>3                 11
>4                 11
>4                 12
>4                 13
>
>
>If sql is not the best approach, any other suggestions would be greatly appreciated.
>
>Thanks in advance,
>Russell
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform