Jump to content

Get a report about the number of active domains of each client


MaRiOsGR

Recommended Posts

  • 7 months later...

Try this SQL query:

 

SELECT tblclients.firstname, tblclients.lastname, tblclients.companyname, tblclients.email, COUNT(tbldomains.id) AS 'domains' 
FROM tbldomains 
INNER JOIN tblclients 
ON tblclients.id = tbldomains.userid 
GROUP BY tbldomains.userid 
ORDER BY domains DESC;

Link to comment
Share on other sites

That's great, thanks!

 

I've been tinkering with this for the past few hours (I'm not a coder!) and arrived at this one myself, which is similar:

 

SELECT tblclients.id, tblclients.firstname, tblclients.lastname, tblclients.email, COUNT( tbldomains.domain ) AS domains
FROM tbldomains
INNER JOIN tblclients ON tblclients.id = tbldomains.userid
AND tbldomains.status =  'Active'
GROUP BY userid
ORDER BY  `domains` DESC 

 

- - - Updated - - -

 

Someone should turn this into a nice report… :)

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