reporting - Finding drop off rate from membership table in SQL Server 2005 -


We have a scene that stores the history of membership plans organized by our members and we charge a half-price direct debit Proposals are running for some time. We are asked to inform that whether people are allowing direct debit (at full cost) to renew, but I am not any SQL expert!

view in effect

memberRef, historyRef, validFrom, validTo, MembershipType, PaymentType, totalAmount

here

< Ul>
  • identifies the memberRef person (int)
  • historyRef this line (int)
  • validFrom and validTo start and plan (date) are identified
  • MembershipType is the type of plan (integer)
  • PaymentType is direct debit or credit card (a string - DD or EFT)
  • totalAmount plan (decimal )
  • If I'm thinking of a cursor vs A layman is a query, I can use to calculate the number of policies which are at half the price and there is another direct debit policy that has been done since then.

    If we can catch that person either on the first half price or if there is a gap where the subscription ended before the half-price incentive was great.

    Thanks in advance for any help! For example,

      select count (MemberRef), maximum (vhOuter.validFrom) "most" (where (vh2.totalamount = 14.97 or vh2.totalamount v_Membershiphistory from vh2) Top (1) vh2.validFrom Selection = 25.50) and vh2.memberref = order by vh.uter.memberref createdat des), "Start planning the start price plan recently" v_membershiphistory from vhOuter where in vhOuter.memberref (v_membershiphistory VH1 where vh1. Totalamount = 14.97 or vh1.totalamount = 25.50 to vh1.memberref) - Maximum group (vhOuter.validFrom) is grouped by memberref; (Select Top (1) v_Membershiphistory from vh2 to vh2.validFrom where (vh2.totalamount = 14.97 or vh2.totalamount = 25.50) and vh2.memberref = vhOuter.memberref by command createdat desc)  

    This will be displayed to those members who have a half-cost plan and are valid from the date which is valid from the date of that plan.

    It is not right because we should check that this is a common plan but ... If I select only the count (Member RFF) here, then I get a member member. For the group I am grouping for each member influenced each of 5220 rows, as well as the number of plans I have chosen

    but I need to calculate the number of those people Retrieve and retrieve the ratio. Also, the rate of renewal in the population which is not taking the proposal (which I'm guessing once a set has been sorted) I think I see how it is going on the set, but each individual Comparison of several rows without using the cursor. But I may be wrong :)

    Try to do something like this:

      SELECT a. *, B. * Join an INNER from Your Tables on your Taylor B at a.memberRef = b.memberRef and a.validToDate & lt; B.validFromDate WHERE b.PaymentType = '? Direct debit? ' And a.Cost = 'half price?'  

    Just means something like to use something:

      select COUNT (a.memberRef) as your total call Join one on your Table b at a.memberRef = B.memberRef and a.validToDate & lt; B.validFromDate WHERE b.PaymentType = 'Direct Debit?' And a.Cost = 'half price?'  

    Comments

    Popular posts from this blog

    c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

    Calling GetGUIThreadInfo from Outlook VBA -

    Obfuscating Python code? -