I have a table that can store different messurement values with type as associated column to store measurement type.
following Is a sample table with data
I am able to self join the table to get ht and wt values based on date. My requirement is, I also need wt values of all dates even if ht for that date is not there in the table.
Sample result
EDIT: I tried below query but it is returning only first row.
SELECT
ta.uid, ta.value as 'wt', lta.value as 'ht', ta.date,ta.id as lftid, lta.id as rtid FROM
[test].[dbo].[tbl2] ta
LEFT JOIN [test].[dbo].[tbl2] Lta
ON ta.[date] = Lta.[date]
AND ta.[uid] = 11 WHERE
ta.type = 'wt'
AND Lta.type ='ht'