Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need help with SELECT
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00174354
Message ID:
00174357
Vues:
24
>What's wrong with my SELECT statement below?
>
>Error I get - "Command contains unrecognized phrase/keyword."
>
>I am trying to select records for a certain year that have a certain ID code and count/list them by month for assorted zip codes.
>
>cField = cRetVal
>
>SELECT mytable.zip, mytable.date ;
> FROM mytable ;
> WHERE YEAR(mytable.date) = YEAR(DATE())-1 .AND. ;
> WHERE mytable.&cField = "1A" .OR. ;
> mytable.&cField = "1B" .OR. ;
> mytable.&cField = "1C" .OR. ;
> ORDER BY MONTH(mytable.date) ;
> INTO CURSOR rpt
>
>Thanks for helping me out.

In addition to what's Marty says, you don't need ".OR." before ORDER BY
And this one will be shorter:

SELECT mytable.zip, mytable.date ;
FROM mytable ;
WHERE YEAR(mytable.date) = YEAR(DATE())-1 ;
AND mytable.&cField IN ("1A", "1B", "1C") ;
ORDER BY MONTH(mytable.date) ;
INTO CURSOR rpt

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform