|
|
select '' Row ,'MULTI'Insurance_Company_Code,
case len(certificate_no)
when 1 then '0000000' + rtrim(ltrim(str(certificate_no)))
when 2 then '000000' + rtrim(ltrim(str(certificate_no)))
when 3 then '00000' + rtrim(ltrim(str(certificate_no)))
when 4 then '0000' + rtrim(ltrim(str(certificate_no)))
when 5 then '000' + rtrim(ltrim(str(certificate_no)))
when 6 then '00' + rtrim(ltrim(str(certificate_no)))
when 7 then '0' + rtrim(ltrim(str(certificate_no)))
else rtrim(ltrim(str(certificate_no)))
end Certificate_No,'MULTI' + proposal_form.proposal_form_no Proposal_Form_No,
proposal_form.dealer_code Dealer_Code,dealer_name Dealer_Name,
car_registration_no Vehicle_Registration_No,
convert(char(10),car_registration_date,103) Date_of_Registration,
proposal_form.sum_insured Sum_Insured,
insured_name Customer_Name,
Certificate_Insurance.insurance_period*12 EWP_Period,
convert(char(10),Inception_date,103) EWP_Period_Start,
convert(char(10),expiry_date,103) EWP_Period_End,
case status
when 'I' then Certificate_Insurance.premium_amount
when 'V' then -Certificate_Insurance.premium_amount
end PREMIUM,
case status
when 'I' then Certificate_Insurance.premium_amount*10/100
when 'V' then -Certificate_Insurance.premium_amount*10/100
end Commissioin,
insured_identification Customer_NRIC,
car_chassis_no Chasis_No,
car_engine_no Engine_No
from Proposal_Form, State, Certificate_Insurance, Finance_Company, Dealer
where certificate_insurance.date_print
between convert(datetime, '30-11-2004 00:00',103) and convert(datetime, '30-12-2004 23:59',103)
and Proposal_Form.insured_state_code = State.state_code
and Proposal_Form.proposal_form_no = Certificate_Insurance.proposal_form_no
and Proposal_Form.finance_company_code = Finance_Company.finance_company_code
and Proposal_Form.dealer_code = Dealer.dealer_code
and Proposal_Form.Proposal_Form_no like 'A%'
order by certificate_no
-----------------------------
我的 "ROW" cloumn 会 DISPLAY NULL 的,我如何 DISPLAY 1 在 1ST ROW, 2 在 2ND ROW,..... 到 VALUE 95 在 第95 ROW, 如果 TOTAL DATA 是有 95 RECORD。。的的。。 |
|