In my sql database,I have two tables one is Invoices and another table called invoiceitems.So am fetching customer details from invoices(invoices table) along with the invoice items(from invoice item table). I am facing one problem in my sql code.Datas are not fetching if invoice have no items in the invoiceitems table.
I want to fetch all datas including if invoices have no items in the invoice item table. Below sql code only generating the invoices have the invoiceitems. So can anyone help me to do this??
$sql = "SELECT
a.cusName,
a.cusMob,
a.invoiceNo,
a.invoiceDate,
a.total_VAT,
a.bill_tot,
b.itemsName ,
b.rate,
b.amt_vat,
ROUND(b.amt_vat + b.amount, 2) as amount
FROM
invoices a,
invoice_items b
where
a.invoiceID=b.invoiceid
and a.invoiceDate between '$getfromdate' and '$gettodate'
and a.status IS NULL
order by
a.invoiceID desc";