oracle - Query for delete -


i have employee table in database have 2 column employee_card , ledger_month. employee can have relation multiple ledger month. want keep employee highest ledger month , rest deleted.

input:    employee_card      ledger_month      1                111112     1                111114     2                111112     2                111114     output :     employee_card      ledger_month      1                111114     2                111114 

i tried query

delete v2titas.employee_copy_upgraded card  not in(select card,max(ledger_month) v2titas.employee_copy_upgraded  group card) or  ledger_month not in (select card,max(ledger_month)  v2titas.employee_copy_upgraded group card) 

but showing error "too many value". how can this?

   delete v2titas.employee_copy_upgraded et exists ( select * v2titas.employee_copy_upgraded  et.card = it.card , et.ledger_month < it.ledger_month    ); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -