Count of Records in a Container

Home | Tutorials | Compare

 

This tutorial explains how to query ldap to find the count of records in a container.

The SQLLDAP count syntax is simple and look like this:

SELECT COUNT(*) FROM Container

In this tutorial we will explain how to find the count of all the records in Ldapsoft test server container 'o=stooges', count of all the records created in the last 3 months and count of all records created yesterday.

To run the statements, first connect to the directory server (To create a new connection please see Connecting to a LDAP Server using LDAP Admin Tool). After successful connection, select the SQL button from the top menu, this will open the sql tab where you can enter the sql statements.

 

Query LDAP Using Select Statments

 

To find the count of all records in the container o=stooges enter the following sql statement in the SQL Pane:

SELECT COUNT(*) FROM o=stooges

and also increase the Max Results to 10,000 as we expect to get a count of 2790 and default max is 1000.

 

Ldap Count of Records

 

Now Click the Run button from the top menu or from right click context menu. After successful run a dialog will open showing a total number of records in the container o=stooges.

 

Select Count of records from LDAP

 


To find the count of all records created in the last 3 months we enter a statement as:

SELECT COUNT(*) FROM o=stooges WHERE createTimestamp >= CurrentTimestamp -3 months

when you run this statement a dialog will appear showing you a total number of records in container o=stoogers created in last 3 months

 

 


To find the count of all records created yesterday, we enter a statement as:

SELECT count(*) from o=stooges where createTimestamp <= CurrentEndofDay -1 days and createTimestamp >=CurrentStartofDay -1 days

when you run that statement a dialog will appear showing you a total number of records created yesterday in container o=stooges.

 
 

LDAP Count of records created yesterday

 

See Also:


LDAP Select Statements Examples
Schedule LDAP Excel Export using Select Statement
Update an attribute of all entries