Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Syntax
Message
 
 
To
13/11/2008 12:18:48
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01361709
Message ID:
01361714
Views:
16
>Can you help me with the derived table. What is it exactly do I need to do to fix this?

In your derived table remove OrdNo and other unique fields and group by the rest of the fields and get max of your possible dup field. Then join with the main table based on all fields you grouped on.

In other words,
select myTable.* from myTable inner join (select myGrpField1, myGrpField2, ;
max(Field3) as MaxField from myTable group by 1,2 where myCondition) myDerived ;
ON myTable.myGrpField1 = myDerived.myGrpField1 and ;
myTable.myGrpField2 = myDerived.myGrpField2 ;
and myTable.Field3 = myDerived.MaxField
There are other ways to get the same info.

Let me know if you need help verbatim with your original query or the info above is enough.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform