SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REF_NO  PRODUCT  MTR
  2. 1       200       20
  3. 1       200       21
  4. 1       300       35
  5. 1       400       42
  6. 2       200       21
  7. 2       399       31
  8.    
  9. REF_NO  PRODUCT  MTR
  10. 1       200       20
  11. 1       200       21
  12.    
  13. select t.REF_NO, t.PRODUCT, t.MTR
  14. from (
  15.     select REF_NO, PRODUCT    
  16.     from MyTable
  17.     group by REF_NO, PRODUCT
  18.     having count(distinct MTR) > 1
  19. ) tm
  20. inner join MyTable t on tm.REF_NO = t.REF_NO
  21.     and tm.PRODUCT = t.PRODUCT
  22.    
  23. select a.REF_NO, a.PRODUCT, a.MTR
  24.   from MYTABLE a, MYTABLE b
  25. where a.REF_NO = b.REF_NO, a.PRODUCT = b.PRODUCT
  26.    and a.MTR <> b.MTR;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top