Hello.
This is more a general SQL question.
I'm trying to return just the FIRST match from a child table which is correlated with a related row in a parent table. For instance:
for table parent with columns (id, name) and these values:
(1, "Bill")
(2, "Joe")
for table child with columns (parent_id, name, birth_ord)
(1, "Bob", 2)
(1, "Eve", 1)
(1, "Dan", 3)
(2, "Sue", 2)
Can I create a single sql statement (without using intermediate temp tables) that will return the first child for each parent, like this?
(id, parent name, child name)
(1, "Bill", "Eve")
(2, "Joe", "Sue")
I was hoping to use "select first 1" within a subquery but evidently this is not allowed.
Thanks,
Bill