select
p1.PA_VALUE as Quote_number,
p2.PA_VALUE as Project_Name,
p3.PA_VALUE as requestNumber,
p4.PA_VALUE as reqLocation_CHECK,
p5.PA_VALUE as reqActivityCode,
p6.PA_VALUE as reqSegment,
p7.PA_VALUE as reqTotalPRLocalMargin_CHECK,
p8.PA_VALUE as reqDiscountPerc_CHECK,
p10.PA_VALUE as RequisitionerName,
p11.PA_VALUE as Date_Start,
p13.PA_VALUE as reqTotalPRNetNet_CHECK,
p14.PA_VALUE as reqCustomerNumber,
p15.PA_VALUE as Is_Validated
from WP_WorkflowProcess p
LEFT JOIN PA_PARAMETER p1 on p1.PA_WP_ID=p.WP_ID AND p1.PA_NAME = 'reqQuoteNumber'
LEFT JOIN PA_PARAMETER p2 on p2.PA_WP_ID=p.WP_ID AND p2.PA_NAME = 'reqProjectName'
LEFT JOIN PA_PARAMETER p3 on p3.PA_WP_ID=p.WP_ID AND p3.PA_NAME = 'RequestNumber'
LEFT JOIN PA_PARAMETER p4 on p4.PA_WP_ID=p.WP_ID AND p4.PA_NAME = 'reqCustomerLocation'
LEFT JOIN PA_PARAMETER p5 on p5.PA_WP_ID=p.WP_ID AND p5.PA_NAME = 'reqActivityCode'
LEFT JOIN PA_PARAMETER p6 on p6.PA_WP_ID=p.WP_ID AND p6.PA_NAME = 'reqSegment'
LEFT JOIN PA_PARAMETER p7 on p7.PA_WP_ID=p.WP_ID AND p7.PA_NAME = 'reqTotalPRLocalMargin'
LEFT JOIN PA_PARAMETER p8 on p8.PA_WP_ID=p.WP_ID AND p8.PA_NAME = 'reqDiscountPerc'
LEFT JOIN PA_PARAMETER p10 on p10.PA_WP_ID=p.WP_ID AND p10.PA_NAME = 'RequisitionerName'
LEFT JOIN PA_PARAMETER p11 on p11.PA_WP_ID=p.WP_ID AND p11.PA_NAME = 'LaunchDate'
LEFT JOIN PA_PARAMETER p13 on p13.PA_WP_ID=p.WP_ID AND p13.PA_NAME = 'reqTotalPRNetNet'
LEFT JOIN PA_PARAMETER p14 on p14.PA_WP_ID=p.WP_ID AND p14.PA_NAME = 'reqCustomerNumber'
LEFT JOIN PA_PARAMETER p15 on p15.PA_WP_ID=p.WP_ID AND p15.PA_NAME = 'isValidated'
WHERE p.WP_TYPE = 'EnergyMarketing'
AND CONVERT(DATETIME, p11.pa_value) >= CONVERT(DATETIME, '01.01.2012')
AND CONVERT(DATETIME, p11.pa_value) <= CONVERT(DATETIME, '01.09.2012')