Hi all
I have a SQL view which joins a number of tables. One particular join is causing me trouble.
I am using a Left Outer Join between table C and D on the fields Lot_Id and Wh_Id.
I need the Table C record in all cases.
Records in table D may not exist (for any particular combination of Lot_Id and Wh_Id in Table C) but where they do, there might be 15 records in D and i only want the record which meets a certain criteria:
dbo.d.code = 'RM'
The problem is as soon as i put this criteria in the WHERE statement, no records are returned at all if there is no Table D record meeting this 'RM' criteria.
Have tried using Inner Join but same problem
I think i may need a subquery but do not know how to set this up
Any advice gratefully received
I have a SQL view which joins a number of tables. One particular join is causing me trouble.
I am using a Left Outer Join between table C and D on the fields Lot_Id and Wh_Id.
I need the Table C record in all cases.
Records in table D may not exist (for any particular combination of Lot_Id and Wh_Id in Table C) but where they do, there might be 15 records in D and i only want the record which meets a certain criteria:
dbo.d.code = 'RM'
The problem is as soon as i put this criteria in the WHERE statement, no records are returned at all if there is no Table D record meeting this 'RM' criteria.
Have tried using Inner Join but same problem
I think i may need a subquery but do not know how to set this up
Any advice gratefully received