Home Forums SQL Server 2008 T-SQL (SS2K8) SQL Query to select one row and fill missing columns from another matching row. RE: SQL Query to select one row and fill missing columns from another matching row.

  • Record num 3 should be retrieved with the marital status and employment status from record two as they were null.

    I read this as 3 being a later record than 2.

    The marital status & employment status do ascend in the sample data, but if they don't, selecting MAX() may get a value from any record, not necessarily the latest. Same goes for the other columns e.g. email address may change to something which sorts lower e.g. "john@aaa.com". So selecting MAX() may not get the latest results.