Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selecting last three records
Message
 
 
To
22/03/2012 06:16:25
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01539026
Message ID:
01539028
Views:
53
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform