loveindia Posted July 29, 2015 Report 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...
CheGuevara Posted July 29, 2015 Report 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
loveindia Posted July 29, 2015 Report 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...
CheGuevara Posted July 29, 2015 Report 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
loveindia Posted July 29, 2015 Report 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...
agora Posted July 29, 2015 Report 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...
CheGuevara Posted July 30, 2015 Report Posted July 30, 2015 TS ... PM ki reply icha....chusukoni reply evu work avtundo ledo
Recommended Posts