Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding Max Salary
Message
From
13/04/2007 19:21:53
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01215436
Message ID:
01215869
Views:
16
Naomi - Data looks fine.

I probably could have accomplished the same thing with enginebehavior set to 70 and using max(salary) like many of us did in the earlier version of VFP. With 9 it appears Sergey is getting around the requirements to group by sif_no and the Class Code in the "group by clause" by using min(ClassCode).

I have done that on occassion but was too brain dead this morning to think of it. So Sergey on his white horse came and rescued me as he has done for a lot of us.

Thanks for your concern.
Gaylen



>Hi Gaylen,
>
>Take a closer look at your requirements and make sure you really got what you need.
>
>>I have a table with the following fields sif_no, ClassCode, Salary. There are many ClassCodes for a policy. I want to get the ClassCode with the highest salary. See snippet of code below that I use. However, if there is a policy(sif_no) with two class codes with the same salary it will pick up both.
>>
>>I would like to have only 1 ClassCode returned in the query and it doesn't matter which ClassCode is selected.
>>
>>
>>
>>***get the max salary and class code
>>Select sif_no, class_code,  salary ;
>>	from tmpmem_class  a ;
>>	WHERE salary = ( Select Max(salary) From tmpmem_class b ;
>>	WHERE a.sif_no = b.sif_no)  ;
>>	INTO Cursor tmpmax
>>
>>
>>
>>
>>
>>Any suggestions.
>>
>>Gaylen
Previous
Reply
Map
View

Click here to load this message in the networking platform