Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to replace limit amount with zero
Message
 
To
14/06/2006 07:00:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01128871
Message ID:
01128936
Views:
19
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform