8:21 PM

ohohoh~ my longest query so far.. VERY LONG..~

HISTORY OF MY LONGGGEST QUERY!
- takes about 3 days 3 nights
- more than 50 times error messages come out, and said :

+ ops wrong query.. that variable isnt exist also.. sigh~!
+ no no.. that clause, this clause cant be here if.. bla.. bla
+ haha.. i know you expect this.. ya right, still wrong
+ ya.. you can say that.. but still..
+ you know what.. you better go buy SQL books and study first
+ have you ever use query? Dont make me mad..
- after 3 days and 3 nights
+ do you the guy that i know last time?
+ waa~ good2
+ are you the writer of the SQL books

FINNALLY... can get rid of all errors..
and this query just return me.. 30 x 16 table.. GG~


Who know this SQL Query is for what..?




string
x_sqlSelectList = " SELECT li.lampiran_id as id,li.row1_per as sa,li.column1_txt,li.column2_txt , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=1 AND li.lampiran_id=qf.lampiran_id) AS jan , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=2 AND li.lampiran_id=qf.lampiran_id) AS feb , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=3 AND li.lampiran_id=qf.lampiran_id) AS mac , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=4 AND li.lampiran_id=qf.lampiran_id) AS apr , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=5 AND li.lampiran_id=qf.lampiran_id) AS mei , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=6 AND li.lampiran_id=qf.lampiran_id) AS jun , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=7 AND li.lampiran_id=qf.lampiran_id) AS jul , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=8 AND li.lampiran_id=qf.lampiran_id) AS ogos , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=9 AND li.lampiran_id=qf.lampiran_id) AS sept , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=10 AND li.lampiran_id=qf.lampiran_id) AS okt , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=11 AND li.lampiran_id=qf.lampiran_id) AS nov , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=12 AND li.lampiran_id=qf.lampiran_id) AS dis , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND li.lampiran_id=qf.lampiran_id) AS jumlah ,(SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=1 AND li.lampiran_id=qf.lampiran_id) AS jan2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=2 AND li.lampiran_id=qf.lampiran_id) AS feb2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=3 AND li.lampiran_id=qf.lampiran_id) AS mac2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=4 AND li.lampiran_id=qf.lampiran_id) AS apr2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=5 AND li.lampiran_id=qf.lampiran_id) AS mei2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=6 AND li.lampiran_id=qf.lampiran_id) AS jun2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=7 AND li.lampiran_id=qf.lampiran_id) AS jul2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=8 AND li.lampiran_id=qf.lampiran_id) AS ogos2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=9 AND li.lampiran_id=qf.lampiran_id) AS sept2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=10 AND li.lampiran_id=qf.lampiran_id) AS okt2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=11 AND li.lampiran_id=qf.lampiran_id) AS nov2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=12 AND li.lampiran_id=qf.lampiran_id) AS dis2 , " +
" (SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND li.lampiran_id=qf.lampiran_id) AS jumlah2 FROM qualityMeasure_lampiranInfo as li,stationtype as st " +

" UNION " +

" SELECT li2.lampiran_id as id,li2.row2_per as sa,li2.column1_txt,li2.column2_txt , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=1 AND li2.lampiran_id=qf.lampiran_id) AS jan , " +
" (SELECT SUM(qf.row1col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=2 AND li2.lampiran_id=qf.lampiran_id) AS feb , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=3 AND li2.lampiran_id=qf.lampiran_id) AS mac , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=4 AND li2.lampiran_id=qf.lampiran_id) AS apr , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=5 AND li2.lampiran_id=qf.lampiran_id) AS mei , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=6 AND li2.lampiran_id=qf.lampiran_id) AS jun , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=7 AND li2.lampiran_id=qf.lampiran_id) AS jul , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=8 AND li2.lampiran_id=qf.lampiran_id) AS ogos , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=9 AND li2.lampiran_id=qf.lampiran_id) AS sept , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=10 AND li2.lampiran_id=qf.lampiran_id) AS okt , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=11 AND li2.lampiran_id=qf.lampiran_id) AS nov , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=12 AND li2.lampiran_id=qf.lampiran_id) AS dis , " +
" (SELECT SUM(qf.row2col1) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND li2.lampiran_id=qf.lampiran_id) AS jumlah ,(SELECT SUM(qf.row1col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=1 AND li2.lampiran_id=qf.lampiran_id) AS jan2 ," +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=2 AND li2.lampiran_id=qf.lampiran_id) AS feb2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=3 AND li2.lampiran_id=qf.lampiran_id) AS mac2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=4 AND li2.lampiran_id=qf.lampiran_id) AS apr2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=5 AND li2.lampiran_id=qf.lampiran_id) AS mei2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=6 AND li2.lampiran_id=qf.lampiran_id) AS jun2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=7 AND li2.lampiran_id=qf.lampiran_id) AS jul2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=8 AND li2.lampiran_id=qf.lampiran_id) AS ogos2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=9 AND li2.lampiran_id=qf.lampiran_id) AS sept2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=10 AND li2.lampiran_id=qf.lampiran_id) AS okt2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=11 AND li2.lampiran_id=qf.lampiran_id) AS nov2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND month=12 AND li2.lampiran_id=qf.lampiran_id) AS dis2 , " +
" (SELECT SUM(qf.row2col2) FROM quality_formSubmitData as qf ,stationtype AS st WHERE qf.balai_id = st.id AND st.stateName = '" + stateName + "' AND li2.lampiran_id=qf.lampiran_id) AS jumlah2 FROM qualityMeasure_lampiranInfo as li2,stationtype as st2 WHERE (li2.row2_per IS NOT NULL) ORDER BY id ";