I have two recordset, the first:
ID Field1 Field2 Field3 Field4
1 aa1 bb1 cc1 NULL
2 aa2 bb2 cc2 NULL
The second one:
ID Field1 Field2 Field3 Field4
1 aa1 bb1 NULL dd1
2 aa2 bb2 NULL dd2
I would like to create a view that merges the two so that with the same key are grouped in the same line, i would like to get:
ID Field1 Field2 Field3 Field4
1 aa1 bb1 cc1 dd1
2 aa2 bb2 cc2 dd2
I tried this code but did not get the result hoped:
SELECT * FROM (
SELECT
t.ID,
t.Field1,
t.Field2,
t.Field3,
NULL as 'Field4'
FROM TABLE
WHERE ...
UNION ALL
SELECT
t.ID,
t.Field1,
t.Field2,
NULL as 'Field3',
t.Field4
FROM TABLE
WHERE ...
) GROUP BY ID, Field1, Field2