Skip to content
English
  • There are no suggestions because the search field is empty.

How to run an Active membership report using SQL.

This script allows to create a report file from the database.

Overview

 This article explains provides the SQL script, which we can use to create a report for Active memberships up to date.

 Any time a customer requests a report for active membership, we can use SQL to get the data, and save the report as a CSV file.

 We start by searching the server on Logmein, and connect remotely.

After the server is open, launch SQL and create a New Query.

SQL > File > New > Query

 

On the new tab we will paste the script.

Script:

USE ClubspeedV8;

 

SELECT

  c.CustID,

  c.FName AS [First Name],

  c.LName AS [Last Name],

  c.EmailAddress AS [Email],

  c.PhoneNumber AS [Phone],

  c.City,

  c.State,

  c.Country,

  c.TotalVisits,

  c.TotalRaces,

  m.MembershipTypeID,

  mt.Description AS [Membership Type],

  m.ExpirationDate AS [Expiration Date],

  m.LastChanged AS [Last Updated],

  m.Notes,

  m.ByUserID

FROM dbo.Memberships AS m

INNER JOIN dbo.Customers AS c

  ON m.CustID = c.CustID

INNER JOIN dbo.MembershipTypes AS mt

  ON m.MembershipTypeID = mt.MembershipTypeID

WHERE m.ExpirationDate >= '2025-10-31'

AND (c.Deleted IS NULL OR c.Deleted = 0)

AND (mt.Enabled = 1 OR mt.Enabled IS NULL)

ORDER BY m.ExpirationDate ASC;

 

Note:  Before running the script, make sure to change this line,  WHERE m.ExpirationDate >= '2025-10-31', to today's date, or the day requested by customer.

 

To complete the query, click on the button Execute.

Next, scroll mouse to the results, click on any cell, and select all by pressing keys, Ctrl + A

(We can also use Edit tab > Select all)

 To create the report file, right click on any cell and click on Save results as, and select the Desktop to save the new file.