Hello,
I am looking for help with an SQL (simple?) problem.
Here a little example, better than extra larges sentences...
Here my TABLE t
id A B
1 5 1
2 2 1
3 15 1
4 7 2
5 3 2
6 1 2
7 6 2
8 7 2
I need to get the 'id'
for each group B
where A is minimal in each group
For this example, result is
id A B
2 2 1
6 1 2
And if it's possible, a more hardous result...
Counting the position of B in each group, so result is :
id A B C
1 5 1 2
2 2 1 1
3 15 1 3
4 7 2 4
5 3 2 2
6 1 2 1
7 6 2 3
8 8 2 5
Thanks to give me a SQL query that can help me or the fantastic SQL instruction that missed me...
TorF
I am looking for help with an SQL (simple?) problem.
Here a little example, better than extra larges sentences...
Here my TABLE t
id A B
1 5 1
2 2 1
3 15 1
4 7 2
5 3 2
6 1 2
7 6 2
8 7 2
I need to get the 'id'
for each group B
where A is minimal in each group
For this example, result is
id A B
2 2 1
6 1 2
And if it's possible, a more hardous result...
Counting the position of B in each group, so result is :
id A B C
1 5 1 2
2 2 1 1
3 15 1 3
4 7 2 4
5 3 2 2
6 1 2 1
7 6 2 3
8 8 2 5
Thanks to give me a SQL query that can help me or the fantastic SQL instruction that missed me...
TorF