Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Findout year except given year
Message
De
15/04/2005 09:01:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
15/04/2005 00:00:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Divers
Thread ID:
01004465
Message ID:
01005063
Vues:
17
SELECT * FROM YourTable WHERE YEAR(YourTable.YourDateField) < 2004 INTO CURSOR cCursor

The part in the code above, which I put in bold, is the condition that selects records. It can be replaced by many other conditions, depending exactly what you want. For example:

year(Table.DateField) # 2005 will select records from any year, except 2005.

not between(year(DateField), 2003, 2005) will select all records, except for years 2003-2005.

not inlist(year(DateField), 2002, 2004, 2006) will select records for all years except for the years specified (2002, 2004, 2006).

You can even have the years which you want excluded in a table, and use a subquery as follows:
SELECT * FROM YourTable WHERE YEAR(YourTable.YourDateField) not in (select Year from ExcludedYears)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform