I have two tables:
First:
id | title
1 | aaa
2 | bbb
3 | ccc
Second:
id | first_id | one | two | three | four
1 | 1 | 3 | 1 | 4 | 6
2 | 2 | 4 | 4 | 1 | 2
3 | 3 | 1 | 2 | 3 | 4
and i would like show:
id | title | min | max
1 | aaa | 1 | 6
2 | bbb | 1 | 4
3 | ccc | 1 | 4
Is this possible with SQL? How? 🙂
Read Tom’s answer, this would be the best to do.
Anyway, and shame on me :
you can remove MIN and MAX (and Group by) if Second can’t have many rows with same first_id.