wss4a Posted October 8, 2014 Share Posted October 8, 2014 Hello Everyone, New to this forum and hope someone can help. I did try asking support and was willing to pay for an easy query. They're not providing paid services anymore. This is what I need. I need to join the clients table with the products table. I need a report that provides me the names of all of our plans (would be nice to have the price of the recurring fee of that plan) with how many clients are on that plan that are active. I started writing a query to get this information, but I don't know the the table structures to join them together. I realize that the client id is different from the plan id and the clientid is not primary. SELECT tblclients.status; tblproducts.name; Count (*) FROM tblclients Left Join tblproducts On tblclients.ID = tblproducts.ID WHERE Status = Active Could someone help me out? Thank you, Steve 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted October 9, 2014 Share Posted October 9, 2014 SELECT t1.name, COUNT(t2.userid) AS clients, t3.monthly, t3.quarterly, t3.semiannually, t3.biennially, t3.triennially FROM tblproducts AS t1 LEFT JOIN tblhosting AS t2 ON t1.id = t2.packageid LEFT JOIN tblpricing AS t3 ON t1.id = t3.relid WHERE t2.domainstatus = 'Active' GROUP BY t1.id 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.