Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group By Statement
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Group By Statement
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01612581
Message ID:
01612581
Views:
68
I Have Following Table:

Customer StockGroup Price PriceDate
C01 G01 100.00 1 Jan 2014
C01 G01 200.00 1 Dec 2014
C01 G01 300.00 1 Jun 2014
C02 G55 400.00 1 Nov 2014
C02 G55 500.00 1 Jun 2014
C02 G55 600.00 1 Feb 2014

I want to do a Select Cutomer,StockGroup,Latest(Price) Group by Customer,StockGroup

Result would be:
C01 G01 200.00 (200.00 being dated 1 Dec 214 whcih is the latest Price Date in the Group C01 - G01)
C02 G55 400.00 (400.00 being dated 1 Nov2014 whcih is the latest Price Date in the Group C02 - G55)

i.e. Instead of say Max(Price) , I want the Most Recent Price to appear on the Destination Table

Is there any Sql Select that will do this ?

Tia
Gerard
Next
Reply
Map
View

Click here to load this message in the networking platform