Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL help.
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01066461
Message ID:
01066509
Views:
19
Excellent. Thanks again.
Allen

>IN VFP9 you can use select in a column but it may be less efficient.
>SELECT DISTINCT stationno, ;
>	(SELECT sum(mt1.colamt1) FROM mytable mt1 JOIN mt ON mt.stationno = mt1.stationno WHERE tranno=1) AS colamt1, ;
>...;
>from mytable mt ;
>INTO CURSOR tmp NOFILTER
>
>
>>Thank you Sergey.
>>Just curious, is there a way to do it without the iif statements?
>>Allen
>>
>>>You don't need DISTINCT with GROUP BY
SELECT stationno, ;
>>>	sum(IIF(tranno=1,colamt1, 0000000.00)) AS colamt1, ;
>>>	sum(IIF(tranno=2,colamt2, 0000000.00)) AS colamt2 ;
>>>from mytable ;
>>>GROUP BY stationno ;
>>>INTO CURSOR tmp NOFILTER
>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform