Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Aways get a 3x3 array from a SQlL select command
Message
 
 
À
14/05/2003 08:54:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00788138
Message ID:
00788197
Vues:
30
Try
CREATE CURSOR crsKeys (fixkey C(4))
INSERT INTO crsKeys VALUES("key1")
INSERT INTO crsKeys VALUES("key2")
INSERT INTO crsKeys VALUES("key3")
SELECT key, sum(valuea), sum(valueb) ;
	FROM crsKey ;
		LEFT JOIN mytable ON fixkey = key ;
	WHERE date BETWEEN startdate AND enddate ;
	ORDER BY key ;
	INTO ARRAY arr
>I have a Select command similar to the following
>
>      SELECT key, valuea, sun(valueb) from table
>            order by key
>            where between(date,startdate,enddate)
>            into array a
>
>My problem is that I can get 1 to 3 rows in the array depending on the data. What I want is to always get 3 rows with zero for non-existant values. For example assume only key2 has a data. I then want the result like
>
>        key1    0
>        key2   12
>        key3    0
>
>What is the best way of doing this?
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform