Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select last data
Message
 
À
08/06/2006 21:11:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01128007
Message ID:
01128054
Vues:
25
>Hello all,
>
>How to select last month data from mytable.dbf ?
>
>mytable.dbf
>
>daterequired idnumber lastname firstname
>
>2006/05/27 11111 bloe joe
>2006/06/26 22222 hungry brian
>2006/05/19 33333 keeper goalie
>2006/04/18 44444 defence legs
>
>Suppose to have in mynewtable :
>
>2006/05/27 11111 bloe joe
>2006/05/19 33333 keeper goalie
>
>I try this but not sure about syntax in SQL statments:
>
>Select * from mytable into mynewtable where month(daterequired) =
>subs(daterequired,5,2).
>
>TIA

Isn't it supposed to be
2006/06/26 22222 hungry brian ?
This is the last month, if so try:
SELECT daterequired, idnumber, lastname, firstname;
       FROM MyTable;
INNER JOIN (SELECT LEFT(MAX(DTOS(daterequired)),6) AS DtReq FROM MyTable) MyTbl;
      ON LEFT(DTOS(MyTable.daterequired),6) = MyTbl.DtReq;
INTO CURSOR cTest
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
Répondre
Fil
Voir

Click here to load this message in the networking platform