>
>Sagol ! ( sorry, still can't figure out the alt combo for yumushak g )
>
>You a quite correct - removing the fields involving memos let me run the SELECT.
>
>I can't figure out why he's maxing the memo fields - I didn't even know you could CAST that.
>As to WHY it was written this way I hope the guy who wrote it will be able to explain. His mind is strange and wonderful and there is generally "method to his madness" ( deyim - "a reason for something that seems crazy" )
>
>At least now I can see what the other results look like. He is very good at writing very complicated stuff ( I am taking this app over from him ) and most of the time I don't know if he is wrong or I'm just stupid <s>
>,CAST(NULL AS Memo) AS HazardList ;
>
>Definitely throws an error that is invalid on that data type
>
>I think in this case he just needed a blank memo in each record so he could stuff in some other information ( I did it the old fashioned way doing a cartesian join to a dummy table with a memo field ) Not sure what the other ones are for.
>
>
>Thanks again.
I don't use Turkish chars even on Turkish forums:)
Max() workaround is used to mimic VFP7's group by in a way. VFP9 wouldn't allow this:
select cust_id, company, sum(maxordamt) group by 1
VFP7 accepts though it's buggy to accept it. So the workaround is to make the company an aggragate:
select cust_id, max(company) as company, sum(maxordamt) group by 1
Consider data in orders and a group by that works in 7:
select cust_id, order_date, sum(order_net) from orders group by 1
Where does date come from? It's the last physically entered date per customer. In other words you could pick up any value just to populate that column. It is a logical bug. Coincidentally (as the data entered orderly on date and VFP data has a sense of physical entry order of data):
select cust_id, max(order_date), sum(order_net) from orders group by 1
works and gives the same result in VFP9. Just scramble the data rows a bit and you'd get different result in VFP7, while in VFP9 the result is consistent dure to aggregation max().
Anyway I'd rewrite your SQL in 2 steps, one getting the real grouping data and one another joining the result for other fields (may not be easy to formulate).
Cetin