I have two tables as described below:
Table 1 loan_misc_fields
Table 2 misc_fields
I want to populate a view with the loan_id and then the value (from the appropriate value field) in a field named the misc_field_name for each of the misc fields (there are 512 of them). So I would end with a view that contained 513 fields. Can it be done?
Type values are as follows
when misc_field_type = 1 then info will be in either the misc_field_value field or the misc_int_value field (I don't know how that's working, whoever programmed this must have been insane)
when misc_field_type = 3 then info will be in misc_dec_value field
when misc_field_type = 5 then info will be in misc_dt_value field