SQLNewbiexaus
Technical User
Iam sure this a simple one, but I still need help please??
I have these 2 script tables but I need to end up with one table which will return all records from the second table that are not in the first, so has been a status 97 but never been a status 5. Not sure if I should be nesting or putting in temp tables as I want to manipulate the data again from there.
Select Distinct
*
From
History (nolock)
Where
StatusCode = 5
And
DocumentType = 'VN'
Select Distinct
*
From
History (nolock)
Where
StatusCode = 97
And
DocumentType = 'VN'
I have these 2 script tables but I need to end up with one table which will return all records from the second table that are not in the first, so has been a status 97 but never been a status 5. Not sure if I should be nesting or putting in temp tables as I want to manipulate the data again from there.
Select Distinct
*
From
History (nolock)
Where
StatusCode = 5
And
DocumentType = 'VN'
Select Distinct
*
From
History (nolock)
Where
StatusCode = 97
And
DocumentType = 'VN'