I am attempting a simple left join that is giving me problems. I need all the customers listed (table a) regardless of whether or not they have an invoice (table b) between a certain date range. Both of my attempts have yielded the only customer that has an invoice for that period:
select b.clientname,a.* from invdata a left join clidata b on a.clidataid=b.recordid where b.recstatus=1 and b.isactive=1 and a.reccreate between '2015-04-01 00:00:00' and '2015-04-30 23:59:59'; OR
select a.clientname,b.* from clidata a left join invdata b on a.recordid=b.clidataid where a.recstatus=1 and a.isactive=1 and b.reccreate between '2015-04-01 00:00:00' and '2015-04-30 23:59:59'; Little help, please. Thanks!!