Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting last three records
Message
 
 
À
22/03/2012 06:16:25
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01539026
Message ID:
01539028
Vues:
52
Something like
SELECT MemberID FROM MemberInstalments 
  WHERE InstalmentDueDate < getdate() AND NOT (InstalmentPaid = 'true')
  GROUP BY MemberID 
  HAVING COUNT(*) >= 3
>
>I have a membership database. With a members table and a payments table
>
>Members can now pay by monthly instalments.
>If they've elected to do that then the payments table has 12 due payments set up for the member and as they pay those payments are marked as paid.
>
>I want to suspend any member who has not paid their last 3 monthly instalments.
>
>So I'm going to have a regular scheduled job that goes through and suspends members member.
>
>What query do I want to find members whose last 3 payments are still marked as due.
>
>Thanks
>
>Nick
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform