Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date range in select statement
Message
De
05/12/2001 13:35:48
 
 
À
05/12/2001 12:33:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00589506
Message ID:
00590025
Vues:
43
This message has been marked as the solution to the initial question of the thread.
I realize that I'm coming in a little late but it's an interesting problem. What about this:

SELECT
a.clientid,
a.status,
a.effdate AS startdate,
MIN(b.effdate) AS enddate,
DATEDIFF(day, a.effdate, ISNULL(MIN(b.effdate), GETDATE())) AS length
FROM
status a
LEFT OUTER JOIN status b ON a.clientid = b.clientid AND b.effdate > a.effdate
GROUP BY
a.clientid,
a.status,
a.effdate
ORDER BY 1, 3

I had the Query Analyzer open so the query's written in TSQL. I can't think of any reason that it's wouldn't work in VFP with a little tweaking.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform