Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL update syntax
Message
De
22/11/2006 02:54:51
 
 
À
22/11/2006 02:52:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01171410
Message ID:
01171649
Vues:
6
My mistake, change:
Max(kilometri.stanjekm)
to
Max(kilometri.stanjekm) AS MaxKm
>I get "Column MAXKM is not found"?
>
>
>>MaxKm is a field of derived table, result of this query:
>>INNER JOIN (Select kilometri.ID, Max(kilometri.stanjekm);
>> From kilometri;
>> GROUP BY Id WHERE datum < ldDatod) Kmtr;
>>
>>
>>>Hmm. what is Kmtr.MaxKm??? SQL and I are confused :))
>>>
>>>>>Hi!
>>>>>
>>>>>I have table kilometri with 3 fields:
>>>>>ID, datum, stanjekm.
>>>>>
>>>>>I want to update another table with stanjekm for max date which is less then some other date...
>>>>>Here is code which work, but update for max stanjekm. This work, but when someone change km meter in his car, I get wrong result, of course....
>>>>>How to get stanjekm for max datum, but less then ldDatod?
>>>>>
>>>>>
>>>>>Update RptTjedniKm ;
>>>>>	Set Startkm = (Select Max(kilometri.stanjekm) From kilometri ;
>>>>>	where RptTjednikm.ID = kilometri.ID AND kilometri.datum < ldDatod )
>>>>>
>>>>>
>>>>>Branko
>>>>
>>>>Try:
>>>>
>>>>Update RptTjedniKm ;
>>>>	Set Startkm = Kmtr.MaxKm;
>>>>FROM RptTjedniKm;
>>>>INNER JOIN (Select kilometri.ID, Max(kilometri.stanjekm);
>>>>                   From kilometri;
>>>>                   GROUP BY Id WHERE datum < ldDatod) Kmtr;
>>>>ON RptTjednikm.ID = Kmtr.ID
>>>>
>>>>
>>>>Make a good backup first :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform