Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL command: syntax needed
Message
From
22/03/2004 10:54:02
 
 
To
22/03/2004 10:37:33
Bruno Maddalozzo
Informatica Aziendale
Arsie, Italy
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00888526
Message ID:
00888536
Views:
12
>I need a query to extract the most recent price inserted for a product
>i.e.
>
>
>id_product    year   price
>1             2004   12004
>1             2003   12003
>2             2003   22003
>2             2002   22002
>
>
>so as to obtain
>
>id_product    year   price
>1             2004   12004
>2             2003   22003
>
>
>
>Which is the SQL syntax to perform the Select?
>TIA

SELECT TOP 1 price FROM {table} ORDER BY year DESC
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform