Kostya gave you good feedback on this so you may need to tweak it to get it to work for your data set.
you will need to outer join your tables so you pull all records from Table A.
You likely need to join on the serviceid, not triple join you are doing. You may even need a third table that is the intermediate table of the two you are using.
You also have to be careful how you write your select stament as this can make an outer join into an inner join.
Whenever dealing with NULLs you have to make that the first part of your statement.
(isnull(table.field) or table.field=?param)
and
table.date in ?begindate to ?enddate
Edited by DBlank - 13 Feb 2012 at 7:59am