loveindia Posted July 28, 2015 Report Share Posted July 28, 2015 bhayya syntax chusta le kani .. oka doubt .. ee script lo edo kotha basha undi ..ee basha ni oracle forms6i accept chesatada ... casue ee script ni form lo cursor laga define chesi records fetch cheyali oracle aaa... :( aa mukka nenu code raayaka mundu cheppali man.... CTE's teesesi anni subqueries gaa maarchi raasko... oracle elagu rank ani undi gaa use that... row number undo ledo telidu.... Link to comment Share on other sites More sharing options...
nenu_devudni Posted July 28, 2015 Author Report Share Posted July 28, 2015 oracle aaa... :( aa mukka nenu code raayaka mundu cheppali man.... CTE's teesesi anni subqueries gaa maarchi raasko... oracle elagu rank ani undi gaa use that... row number undo ledo telidu.... aa matram teliste ee patiki fafa ni padesi loving sese vadini ... adedo nuve rasi punyam katuko radu vuncle sSc_hidingsofa Link to comment Share on other sites More sharing options...
loveindia Posted July 28, 2015 Report Share Posted July 28, 2015 try this devudu... ammai number marchipoku.... SELECT uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg FROM( SELECT *, ROW_NUMBER() OVER(PARTITION BY ????? ORDER BY alert_type) FROM CTE 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' ) a ) b WHERE rnum = 1 Link to comment Share on other sites More sharing options...
rikki Posted July 28, 2015 Report Share Posted July 28, 2015 in that case you have to read the question clearly man What will happen if he doesn't pass minv_code man... you have to take all scenarios into account man... Link to comment Share on other sites More sharing options...
loveindia Posted July 28, 2015 Report Share Posted July 28, 2015 in that case you have to read the question clearly man ok then read man... Link to comment Share on other sites More sharing options...
nenu_devudni Posted July 28, 2015 Author Report Share Posted July 28, 2015 ok then read man... Link to comment Share on other sites More sharing options...
nenu_devudni Posted July 28, 2015 Author Report Share Posted July 28, 2015 try this devudu... ammai number marchipoku.... ratle vuncle ... from keyword not found antundi .. :3D_Smiles_38: SELECT uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg FROM( SELECT *, ROW_NUMBER() OVER(PARTITION BY uwtsmee_minv_code ORDER BY alert_type) FROM CTE 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') a) b WHERE rnum = 1 Link to comment Share on other sites More sharing options...
compose Posted July 28, 2015 Report Share Posted July 28, 2015 devudu Link to comment Share on other sites More sharing options...
loveindia Posted July 28, 2015 Report Share Posted July 28, 2015 from cte teesesi rnum ani petti chudu man.... row_number is in oracle too but code wise idi correct aa kaado telidu man.... i dont have sql developer also to check Link to comment Share on other sites More sharing options...
rikki Posted July 28, 2015 Report Share Posted July 28, 2015 cinemala prabhavam entha undo telvadu kani gif prabhavam gatiga undi ok then read man... Link to comment Share on other sites More sharing options...
CheGuevara Posted July 28, 2015 Report Share Posted July 28, 2015 annitiki one vastundi kada man ila raastey, you are not considering each individual record kada... ala antava Link to comment Share on other sites More sharing options...
ranku_mogudu Posted July 28, 2015 Report Share Posted July 28, 2015 devudu man, papa ee range lo untundhi ani intha sahasam chestunnav?? ento ee project lo maga vasana and aunty la hadavidi tappa !! virakthiyo Link to comment Share on other sites More sharing options...
loveindia Posted July 28, 2015 Report Share Posted July 28, 2015 cinemala prabhavam entha undo telvadu kani gif prabhavam gatiga undi ippdu cheppu man what to do what not to do?? Link to comment Share on other sites More sharing options...
agora Posted July 28, 2015 Report Share Posted July 28, 2015 @cn Link to comment Share on other sites More sharing options...
CheGuevara 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 from ( Select uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg, Min(alert_type) min_val 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') group by uwtsmee_prem_code, uwtsmee_model, uwtsmee_asvc_code, uwtsmee_alert_time, uwtsmee_alert_type, uwtsmee_alert_msg); Link to comment Share on other sites More sharing options...
Recommended Posts