Guest User

Untitled

a guest
Dec 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. select *
  2. from (select <columns>,
  3. count() over (partition by "это поле") cnt
  4. from my_table)
  5. where cnt = 1
  6.  
  7. select c.*,
  8. (select count(*) from city c1 where c1.descr = c.descr) as descr_count,
  9. (select count(*) from city c1 where c1.name = c.name) as name_count
  10. from city c
  11. having descr_count = 1 /* или name_count = 1 */
Add Comment
Please, Sign In to add comment