Jump to content

Exporting report for clients that have not ordered a service


Ragonz

Recommended Posts

if you wanted to do this outside of WHMCS, e.g directly in phpmyadmin, then you could run a basic SQL query to find which clients did not have hosting - basically, you're just listing the clients in tblclients who are not in tblhosting...

 

SELECT tblclients.firstname, tblclients.lastname, tblclients.email
FROM tblclients
LEFT  JOIN tblhosting ON tblclients.id = tblhosting.userid
WHERE tblhosting.userid IS NULL 

if you wanted to expand that and get a list of clients who hadn't bought domains and hosting...

 

SELECT tblclients.firstname, tblclients.lastname, tblclients.email
FROM tblclients
LEFT  JOIN tblhosting ON tblclients.id = tblhosting.userid
LEFT  JOIN tbldomains ON tblclients.id = tbldomains.userid
WHERE tblhosting.userid IS NULL 
AND tbldomains.userid IS NULL

from inside phpmyadmin, you'd be able to export the results to a number of formats including pdf and csv.

Link to comment
Share on other sites

  • 5 years later...
On 29/04/2017 at 5:11 PM, brian! said:

if you wanted to do this outside of WHMCS, e.g directly in phpmyadmin, then you could run a basic SQL query to find which clients did not have hosting - basically, you're just listing the clients in tblclients who are not in tblhosting...

 

 


SELECT tblclients.firstname, tblclients.lastname, tblclients.email
FROM tblclients
LEFT  JOIN tblhosting ON tblclients.id = tblhosting.userid
WHERE tblhosting.userid IS NULL 
 

 

if you wanted to expand that and get a list of clients who hadn't bought domains and hosting...

 

 


SELECT tblclients.firstname, tblclients.lastname, tblclients.email
FROM tblclients
LEFT  JOIN tblhosting ON tblclients.id = tblhosting.userid
LEFT  JOIN tbldomains ON tblclients.id = tbldomains.userid
WHERE tblhosting.userid IS NULL 
AND tbldomains.userid IS NULL
 

 

from inside phpmyadmin, you'd be able to export the results to a number of formats including pdf and csv.

#Active Clients with no services example - 0 (0)
SELECT tc.id,tc.firstname,tc.lastname,tc.status
FROM tblclients tc
LEFT JOIN tblhosting th ON tc.id = th.userid
LEFT JOIN tblhostingaddons tha ON tc.id = tha.userid
LEFT JOIN tbldomains td ON tc.id = td.userid
WHERE tc.status = 'Active'
AND th.userid IS NULL
AND tha.userid IS NULL
AND td.userid IS NULL
ORDER BY tc.id DESC;

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated