For all kind of reasons (especially if you care about correct result), you should avoid using nolock (see here).
Help us, help you by providing:
- Table descriptions of all involved tables (in the form of create statements)
- Sample data (in the form of insert statements)
- Expected output from the sample data you provide
Ps.: Formatting your queries is good practice