query to return three records for each customer application based on the options declared in the pre

Posted by kumarreddy on Stack Overflow See other posts from Stack Overflow or by kumarreddy
Published on 2010-05-27T04:15:06Z Indexed on 2010/05/27 4:21 UTC
Read the original article Hit count: 192

Filed under:

tables look like this

table1---customer application columns--- application id--primary key, name, ssn, ... ...

table2----balance(actually its a view) columns--- amount balance, application id ...... ......

table3 ---- options columns--- optionid, option value(1,2,3,4), ...... ........ ....

table4 ----- ratios columns--- ratios id, option value, ratio value, applicationid(have to think about it),

........

table 4(detail) option value, Ratios 1 ----- 30 1 ----- 40 1 ----- 30 2 ---- 100 2 ----- 0 2 ------ 0 3 ---- 60 3 ------ 30 3 ----- 10 4 ---- 50 4 ----- 30 4 ----- 20

as is the case...now i need to get three records for each customer application with varying balances in proportion of ratios declared in table 4 corresponding to option values......

plz let me know where i was unclear about returning records

thanks in advance

© Stack Overflow or respective owner

Related posts about sql