Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. with countf as (
  2. select nationid, count(*) as c from customer
  3. group by nationid
  4. ),
  5. maxf as ( select max(nationid) from customer )
  6.  
  7. select c.customerid, c.nationid from customer c, countf cf, maxf m
  8. where c.nationid = cf.nationid
  9. and cf.c = m
  10.  
  11. cf.c = ( select max(nationid) from customer )
  12.  
  13. cf.c in maxf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement