loveindia Posted July 29, 2015 Report Share Posted July 29, 2015 Edi try chey Select uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg, Min(alert_type) from ( SELECT uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg, CASE WHEN uwtsmee_alert_type = 'Meter Removal' Then 1 WHEN uwtsmee_alert_type = 'Tamper Alert' Then 2 WHEN uwtsmee_alert_type = 'Reverse Energy' Then 3 END alert_type FROM uwtsmee WHERE uwtsmee_work_ind is null AND uwtsmee_prem_code = '1018385') sounds reasonable man but appudu result set lo kuda MIN(alert_type) column vastundi kada man... instead HAVING MIN(Alert_type) = 1 ani peditey without group by it will become a filter man... Link to comment Share on other sites More sharing options...
CheGuevara Posted July 29, 2015 Report Share Posted July 29, 2015 sounds reasonable man but appudu result set lo kuda MIN(alert_type) column vastundi kada man... instead HAVING MIN(Alert_type) = 1 ani peditey without group by it will become a filter man... min(alert_type) = 1 ela pedtavu....akkada meter lekunda just temper and reserve unte appudu min(alert_type) 2 avtadi...so 1 ani filter pedite aa min value 2 aina rows egiripotai....basic nuvvu meeda cheppina nee query lo kuda ede bokka undi...... nuvvu chepinattu aa min column rakunda undali ante ...inkoka outer query lo just select the required columns Link to comment Share on other sites More sharing options...
loveindia Posted July 29, 2015 Report Share Posted July 29, 2015 min(alert_type) = 1 ela pedtavu....akkada meter lekunda just temper and reserve unte appudu min(alert_type) 2 avtadi...so 1 ani filter pedite aa min value 2 aina rows egiripotai....basic nuvvu meeda cheppina nee query lo kuda ede bokka undi...... nuvvu chepinattu aa min column rakunda undali ante ...inkoka outer query lo just select the required columns correstey man, nenu indaaka adey cheppa kada ippudu marchipoya man... ya malli outer query is the way... Link to comment Share on other sites More sharing options...
CheGuevara Posted July 29, 2015 Report Share Posted July 29, 2015 correstey man, nenu indaaka adey cheppa kada ippudu marchipoya man... ya malli outer query is the way... yeah anduke naa post edit chesa TS copy paste chesukunte vachela lekunte no group by adi edi antadu ani Link to comment Share on other sites More sharing options...
loveindia Posted July 29, 2015 Report Share Posted July 29, 2015 yeah anduke naa post edit chesa TS copy paste chesukunte vachela lekunte no group by adi edi antadu ani also from (subquery) pettinappudu at the end alias cheyyali kada daanini, or else error vastundi... adi kuda change man or else devudu gussa aitaadu... Link to comment Share on other sites More sharing options...
agora Posted July 29, 2015 Report Share Posted July 29, 2015 you are missing one extra ) man... and also from (subquery) pettinappudu at the end alias cheyyali kada daanini, or else error vastundi... adi kuda change man or else devudu gussa aitaadu... Link to comment Share on other sites More sharing options...
loveindia Posted July 29, 2015 Report Share Posted July 29, 2015 go and study man.. Link to comment Share on other sites More sharing options...
agora Posted July 29, 2015 Report Share Posted July 29, 2015 go and study man.. ade doing Link to comment Share on other sites More sharing options...
CheGuevara Posted July 30, 2015 Report Share Posted July 30, 2015 TS ... PM ki reply icha....chusukoni reply evu work avtundo ledo Link to comment Share on other sites More sharing options...
Recommended Posts