>Hi all
>
>I have parent-child tables. The child table can have 0 or more records for each parent record.
>
>I need to write an SQL where in each row I get a parent record and an either a NULL fields for the child table or only these 1st child record (no multiple occurrence of the parent record due to multiple child recs.), for each and every parent record.
>
>Please let me know how I can go about this.
SELECT *
, (select top 1 field from child WHERE fk_Parent=Parent.pk order by fk_Parent) as child_field
FROM Parent