Jump to content

Sql Experts Urgent Help


nenu_devudni

Recommended Posts

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.... mLO5Za.gif

Link to comment
Share on other sites

  • Replies 68
  • Created
  • Last Reply

Top Posters In This Topic

  • loveindia

    24

  • nenu_devudni

    15

  • CheGuevara

    8

  • SUbba LIngam

    4

Top Posters In This Topic

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.... mLO5Za.gif

bemmi.ok.gif 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

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

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... mLO5Za.gif

 

Link to comment
Share on other sites

 

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

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

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

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

×
×
  • Create New...