Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL command: syntax needed
Message
 
 
À
22/03/2004 10:37:33
Bruno Maddalozzo
Informatica Aziendale
Arsie, Italie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00888526
Message ID:
00888693
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Try
SELECT id_product, year, price ;
	FROM mytable mt1 ;
	WHERE year IN ( SELECT MAX(year) FROM mytable mt2
			 WHERE mt2.id_product = mt1.id_product ) 
>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
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform