Jump to content

how to make a report on last 100 weeks


twister

Recommended Posts

the issue presented is the following:

i have 3 billing cycles used - monthly, quarterly, annually 

i need to make a report of active users per last 100 weeks and show it per each week. making the 100 weeks interval is not an issue, bash takes care of that. 

the problem is what pattern to follow:

for e.g. this does not get me anywhere

SELECT COUNT(*) AS WeekCount 
            FROM tblclients 
            JOIN tblhosting ON tblclients.id = tblhosting.userid
            WHERE  tblhosting.regdate BETWEEN  '2017-01-01' AND week_end_date
            AND tblhosting.packageid IN (1,4)
            AND tblhosting.domainstatus='Active'
            AND tblclients.id in (SELECT DISTINCT(tblinvoices.userid) as id from tblinvoices where tblinvoices.datepaid is not NULL)

the result i get is an ascending progression instead of a declining one - which is the reality. 

 

Link to comment
Share on other sites

On 8/4/2023 at 9:03 PM, bear said:

He left this board quite a while ago, so the odds of him responding are low, I'd say.

For your issue, have you tried "order by" in the query?

yeah, not giving the proper numbers, so sort doesn't help in this case. i feel like I'm missing smth on query. 

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