I made this sql:
select t.teamnaam, l.roepnaam
from team t left outer join lid l on t.trainer = l.l_code
where t.teamnaam like 'H%'
UNION
select '---------', ''
UNION
select 'Aantal teams', string(count(teamnaam))
from team where teamnaam like 'H%'
UNION
select 'Aantal teams met trainer', string(count(trainer))
from team where teamnaam like 'H%';
This is what I get:
__________________________________________________
Teamnaam | Roepnaam
Heren 2 |
Heren 3 |
Heren 4 |
Heren 5 |
----------------- |
Aantal teams met trainer | 1
Aantal teams | 5
Heren 1 | Kees
__________________________|_______________________
This is what I want to get:
__________________________________________________
Teamnaam | Roepnaam
Heren 1 | Kees
Heren 2 |
Heren 3 |
Heren 4 |
Heren 5 |
------------------ |
Aantal teams | 5
Aantal teams met trainer | 1
__________________________|_______________________
I have tried many ways of Order By, but I don't know how to do this,
Can anyone help?
Thank you,
Arjan - from Holland
select t.teamnaam, l.roepnaam
from team t left outer join lid l on t.trainer = l.l_code
where t.teamnaam like 'H%'
UNION
select '---------', ''
UNION
select 'Aantal teams', string(count(teamnaam))
from team where teamnaam like 'H%'
UNION
select 'Aantal teams met trainer', string(count(trainer))
from team where teamnaam like 'H%';
This is what I get:
__________________________________________________
Teamnaam | Roepnaam
Heren 2 |
Heren 3 |
Heren 4 |
Heren 5 |
----------------- |
Aantal teams met trainer | 1
Aantal teams | 5
Heren 1 | Kees
__________________________|_______________________
This is what I want to get:
__________________________________________________
Teamnaam | Roepnaam
Heren 1 | Kees
Heren 2 |
Heren 3 |
Heren 4 |
Heren 5 |
------------------ |
Aantal teams | 5
Aantal teams met trainer | 1
__________________________|_______________________
I have tried many ways of Order By, but I don't know how to do this,
Can anyone help?
Thank you,
Arjan - from Holland