Oracle query that can filter paired data -


i need oracle query can skip 'pairs' , pick non paired data. example:

id      cost   hour type 123     $1.00  1    input  123     $1.00  1    output   234     $2.00  4    input 345     $5.00  4    output  236     $3.00  5    input 236     $3.00  3    output 

in example, first 2 lines 'pair', since thir first 3 fields match; 3rd , 4th, , 5th , 6th lines not 'pair', since first 3 fields not match.

you may use window function , partition by

select id, cost, hour, type   (   select id, cost, hour, type,          count(*) over(partition id, cost, hour) cn   mytable) t cn=1; 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -