ageorge32 avatar image
ageorge32 asked

Calculate expected value of an account using SQL case statement

I have to calculate in a report view an expected value (what we would expect an account to be worth) by using the following information. expectedpaymentvalue (field) in account (table) (a value in dollars to 2 decimal places) (money, null) expectedpaymentfrequency (field) in account (table) (restricted values of: one off, weekly, fortnightly, four weekly, monthly, bi monthly, quaterly) (varchar(50), null) term (field) in account (table) (number of term type until account ends) (int, null) termtype (field) in account (table) (restricted values of: days, weeks, months) (varchar(16), null) startdate (field) account (table) (date when account started) (datetime, null) I know I need a case statement and was hoping to calculate each field seperately so that in the end I can display the total value the account would be worth at the end of the term by multiplying it by the expectedpayment. Would anyone be able to help me with the SQL, Im a beginner and while I have tried to get it to work I am not getting the values I expected and was hoping for some different opinions.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ageorge32 avatar image ageorge32 commented ·
I tried to upload what I have so far but my view is over 5000 characters long. Is there a way to attach it?
1 Like 1 ·
@SQLShark avatar image @SQLShark commented ·
Can you post some sample data? Post what you have and what you want it to look like.
0 Likes 0 ·
@SQLShark avatar image @SQLShark commented ·
I am more looking for what your tables look like and a few obfuscated sample rows. If you cannot paste what you need to on here upload it to somewhere like skydrive and paste a link.
0 Likes 0 ·

0 Answers


Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.