Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select t2.KrajOdbiorcy, t2.ile, IDspedytora from
- (
- select KrajOdbiorcy, count(z.IDspedytora) as ile, z.IDspedytora from Zamówienia z
- join Spedytorzy s on s.IDspedytora = z.IDspedytora
- group by KrajOdbiorcy, z.IDspedytora
- ) as t2
- join(
- select max(ile) as ile, KrajOdbiorcy from
- (
- select KrajOdbiorcy, count(z.IDspedytora) as ile, z.IDspedytora from Zamówienia z
- join Spedytorzy s on s.IDspedytora = z.IDspedytora
- group by KrajOdbiorcy, z.IDspedytora
- ) as t1
- group by KrajOdbiorcy
- )as t3
- on t2.KrajOdbiorcy = t3.KrajOdbiorcy
- where(t2.ile = t3.ile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement