Select Top row from child table
Posted on 2011-03-14
I am writing a sproc to return rows from tableA and I need the first row that was entered in child tableB.
A_ID PK Identity
B_ID PK Identity
A_ID FK int
I am close but not there yet. Since the PK in tableB is an identity I think I'm safe selecting the row that has the min(B_ID) WHERE tableB.A_ID = tableA.A_ID
So I have this
SELECT * FROM tableA, (SELECT DateEntered,Comment FROM tableB WHERE tableB.A_ID = tableA.A_ID)
Hung up getting the rest. Still trying but would like some help.