1: 2: 3: 4: 5: 6: 7: 8:
select * from invoiceHeader a INNER JOIN ( select *,ROW_NUMBER() OVER (PARTITION BY invoiceHeaderID ORDER BY invoiceHeaderID) AS Row from invoicedetail ) X on a.id = X.invoiceHeaderID WHERE X.Row=1