(SELECT SUM(CONVERT(FLOAT, CASE '01' WHEN '01' THEN CASE SIGN((sltr_tran_amt - ISNULL(sltr_matched_amt, 0))) WHEN 1 THEN CASE DBO.glas_aging_oth(CONVERT(DATETIME, '2009/04/04') - FLOOR(sltr_pstng_date)) WHEN 0 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) ELSE 0 END ELSE 0 END WHEN '02' THEN CASE SIGN((sltr_tran_amt - ISNULL(sltr_matched_amt, 0))) WHEN - 1 THEN CASE DBO.glas_aging_oth(CONVERT(DATETIME, '2009/04/04') - FLOOR(sltr_doc_date)) WHEN 0 THEN (sltr_tran_amt - ISNULL(sltr_matched_amt, 0)) ELSE 0 END ELSE 0 END END)) FROM WHERE CASE '01' WHEN '01' THEN sltr_pstng_date ELSE sltr_doc_date END = CASE '01' WHEN '01' THEN sltr_pstng_date ELSE sltr_doc_date END ) thirty_days,
from glas_sl_transactions
hai friends this is my query when i execute this query error is ocurring near 'where' how to avoid this if possible pls tel me how to shorten this query