Salut,

Je m'y prendrais du genre (non testé, SQL2) :

SELECT S.Commerce, S.Prix
FROM   Sondage S
WHERE  S.Marchandise = Id_choisi AND
      S.Date IN (
        SELECT MAX(T.Date)
        FROM   Sondage T
        WHERE  S.Commerce    = T.Commerce AND
               S.Marchandise = T.Marchandise
      )
;

Remarquons qu'on est ennuyé si il y a >1 date max par (Commerce, Marchandise) dans Sondage

Bonne chance,
Amel

Félix Hauri a écrit :

Bonjour,

Cette est une question générale et n'est pas tributaire d'un moteure SQL
en particulier,

Soit trois trois tables:

- Marchandise:
Id          Integer Auto-Increment Indexed
Descrption  Text
Unité ( Kilo ou Piece )
- Commerce:
Id          Integer Auto-Increment Indexed
Nom         Text
Adresse     Text

- Sondages:
Id          Integer Auto-Increment Indexed
Date        Date default=``now''
Commerce    Id(Commerce)
Marchandise Id(Marchandise)
Prix        Floating

J'aimerais réaliser une table temporaire, présentant de la sorte:

- Comparaison:
Marchandise Id(Marchandise)
Commerce_1   Prix (Marchandise, Commerce_1, selon dernier sondage)
Commerce_... Prix (Marchandise, Commerce_..., selon dernier sondage)
Commerce_n   Prix (Marchandise, Commerce_n, selon dernier sondage)

Comment s'y prendre?
Toutes suggestions sera bienvenue, en n'oubliant pas de préciser pour
toutes syntaxes proposée, le moteur utilisé et sa version.




_______________________________________________
gull mailing list
[email protected]
http://lists.alphanet.ch/mailman/listinfo/gull

Répondre à