Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. name abase1 dz pline
  2. acc 1 1 123.45
  3. acc 2 1 128.20
  4. acc 3 2 130.20
  5. acc 4 2 135.20
  6.  
  7. name bbase1 chigh
  8. acc 1 128.20
  9. acc 2 130.25
  10. acc 3 145.20
  11. acc 4 128.05
  12. acc 5 148.20
  13. acc 6 149.50
  14. acc 7 148.70
  15.  
  16. name abase1 pline bbase1 chigh
  17. acc 1 123.45 3 145.20
  18. acc 2 128.20 3 145.20
  19. acc 3 130.20 5 148.20
  20. acc 4 135.20 6 149.50
  21.  
  22. select a.acc,a.abase1,a.pline,b.bbase1,b.chigh from table1 as a inner join table2 as b on a.name=b.name and a.abase1<b.bbase1 and a.pline <b.chigh
  23.  
  24. select a.acc,a.abase1,a.pline,b.bbase1,b.chigh
  25. from table1 as a
  26. inner join table2 as b
  27. on a.name=b.name and a.abase1<b.bbase1 and a.pline <b.chigh
  28. left join table2 as c
  29. on c.name = a.name and a.abase1 < c.bbase1 and a.pline < c.chigh and b.bbase1 > c.bbase1 and b.chigh > c.chigh
  30. where c.bbase1 is null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement