Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to replace limit amount with zero
Message
De
14/06/2006 07:14:48
 
 
À
14/06/2006 07:00:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01128871
Message ID:
01128936
Vues:
25
>Hi ,
>
>I have to use Group by for this part to get the result :
>
>select group, count(*) as MyCount;
> from Table1 group by group;
> into cursor TmpGroup
>
>Still not work,
>
>Anybody else can assist,
>
>Tia
Try:
CREATE CURSOR Test (Group1 C(4), limitamount I, Option C(3))
INSERT INTO TEST VALUES([AAAAA], 1000,[YES])
INSERT INTO TEST VALUES([AAAAA], 2000,[NO])
INSERT INTO TEST VALUES([AAAAA], 3000,[NO])
INSERT INTO TEST VALUES([AAAAA], 4000,[NO])

INSERT INTO TEST VALUES([BBBBB], 5000,[NO])
INSERT INTO TEST VALUES([CCCCC], 6000,[NO])

INSERT INTO TEST VALUES([DDDDD], 7000,[YES])
INSERT INTO TEST VALUES([DDDDD], 8000,[NO])

INSERT INTO TEST VALUES([EEEEE], 9000,[NO])
INSERT INTO TEST VALUES([FFFFF], 2000,[NO])
SELECT Test.GROUP1,;
       IIF(Option = [YES] OR cTotal.Sums = 0, Limitamount,0000) AS Limitamount,;
       Option;
FROM Test;
INNER JOIN (SELECT Tst.Group1, SUM(IIF(Option == [YES],1,0)) AS Sums FROM Test Tst GROUP BY Tst.Group1) cTotal;
      ON Test.Group1 = cTotal.Group1
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform